summaryrefslogtreecommitdiff
path: root/test/Transforms/LICM/hoisting.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-31 23:00:16 +0000
committerChris Lattner <sabre@nondot.org>2010-08-31 23:00:16 +0000
commit2ac6e2354ac9961b00fa351635ed04baf7fdd234 (patch)
treede233dd475f72634bcab390c240d82ce7493c4bb /test/Transforms/LICM/hoisting.ll
parent232ab949d5ed04c4ab45c763e0597fc3fc3fa5bc (diff)
downloadllvm-2ac6e2354ac9961b00fa351635ed04baf7fdd234.tar.gz
llvm-2ac6e2354ac9961b00fa351635ed04baf7fdd234.tar.bz2
llvm-2ac6e2354ac9961b00fa351635ed04baf7fdd234.tar.xz
licm is wasting time hoisting constant foldable operations,
instead of hoisting them, just fold them away. This occurs in the testcase for PR8041, for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LICM/hoisting.ll')
-rw-r--r--test/Transforms/LICM/hoisting.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/LICM/hoisting.ll b/test/Transforms/LICM/hoisting.ll
index e7d36afb91..6f28d53af6 100644
--- a/test/Transforms/LICM/hoisting.ll
+++ b/test/Transforms/LICM/hoisting.ll
@@ -48,3 +48,19 @@ Out: ; preds = %Loop
%C = sub i32 %A, %B ; <i32> [#uses=1]
ret i32 %C
}
+
+
+; This loop invariant instruction should be constant folded, not hoisted.
+define i32 @test3(i1 %c) {
+; CHECK: define i32 @test3
+; CHECK: call void @foo2(i32 6)
+ %A = load i32* @X ; <i32> [#uses=2]
+ br label %Loop
+Loop:
+ %B = add i32 4, 2 ; <i32> [#uses=2]
+ call void @foo2( i32 %B )
+ br i1 %c, label %Loop, label %Out
+Out: ; preds = %Loop
+ %C = sub i32 %A, %B ; <i32> [#uses=1]
+ ret i32 %C
+}