summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-03-21 06:04:36 +0000
committerJuergen Ributzka <juergen@apple.com>2014-03-21 06:04:36 +0000
commit8ebaf637500a6bac4bf734b1c7e8600ac9add6f7 (patch)
tree23c010a70f92196976e06828850bb2016b06710a /test
parent032dafd64ae1a9da38db41dde32de8066e8d518f (diff)
downloadllvm-8ebaf637500a6bac4bf734b1c7e8600ac9add6f7.tar.gz
llvm-8ebaf637500a6bac4bf734b1c7e8600ac9add6f7.tar.bz2
llvm-8ebaf637500a6bac4bf734b1c7e8600ac9add6f7.tar.xz
[Constant Hoisting] Change the algorithm to only track constants for instructions.
Originally the algorithm would search for expensive constants and track their users, which could be instructions and constant expressions. This change only tracks the constants for instructions, but constant expressions are indirectly covered too. If an operand is an constant expression, then we look through the expression to find anny expensive constants. The algorithm keep now track of the instruction and the operand index where the constant is used. This allows more precise hoisting of constant materialization code for PHI instructions, because we only hoist to the basic block of the incoming operand. Before we had to find the idom of all PHI operands and hoist the materialization code there. This also makes updating of instructions easier. Before we had to keep track of the original constant, find it in the instructions, and then replace it. Now we can just simply update the operand. Related to <rdar://problem/16381500> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/ConstantHoisting/X86/phi.ll6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/Transforms/ConstantHoisting/X86/phi.ll b/test/Transforms/ConstantHoisting/X86/phi.ll
index cc2fdda40e..e63c06e91a 100644
--- a/test/Transforms/ConstantHoisting/X86/phi.ll
+++ b/test/Transforms/ConstantHoisting/X86/phi.ll
@@ -19,11 +19,11 @@ return:
ret i8* %retval.0
; CHECK-LABEL: @test1
-; CHECK: entry:
+; CHECK: if.end:
; CHECK: %const_mat = add i64 %const, 1
; CHECK-NEXT: %1 = inttoptr i64 %const_mat to i8*
-; CHECK-NEXT: br i1 %cmp
-; CHECK: %retval.0 = phi i8* [ null, %entry ], [ %1, %if.end ]
+; CHECK: return:
+; CHECK-NEXT: %retval.0 = phi i8* [ null, %entry ], [ inttoptr (i64 68719476736 to i8*), %if.end ]
}
define void @test2(i1 %cmp, i64** %tmp) {