aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/GVN/pre-single-pred.ll
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-06-17 20:48:23 +0000
committerDale Johannesen <dalej@apple.com>2009-06-17 20:48:23 +0000
commita19b67fbac4046bd9e57119dcb39d6c6a6897cb8 (patch)
treeb1be492f650e7abae0d9d3f388a7a2f7e20068b5 /test/Transforms/GVN/pre-single-pred.ll
parenta1a8c7150585718e1e248f1058c9ce850763abf1 (diff)
downloadexternal_llvm-a19b67fbac4046bd9e57119dcb39d6c6a6897cb8.zip
external_llvm-a19b67fbac4046bd9e57119dcb39d6c6a6897cb8.tar.gz
external_llvm-a19b67fbac4046bd9e57119dcb39d6c6a6897cb8.tar.bz2
This fixes a bug introduced in 72661, which can
move loads back past a check that the load address is valid, see new testcase. The test that went in with 72661 has exactly this case, except that the conditional it's moving past is checking something else; I've settled for changing that test to reference a global, not a pointer. It may be possible to scan all the tests you pass and make sure none of them are checking any component of the address, but it's not trivial and I'm not trying to do that here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/GVN/pre-single-pred.ll')
-rw-r--r--test/Transforms/GVN/pre-single-pred.ll9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/Transforms/GVN/pre-single-pred.ll b/test/Transforms/GVN/pre-single-pred.ll
index b735ea9..cb71617 100644
--- a/test/Transforms/GVN/pre-single-pred.ll
+++ b/test/Transforms/GVN/pre-single-pred.ll
@@ -1,6 +1,7 @@
; RUN: llvm-as < %s | opt -gvn -enable-load-pre | llvm-dis | not grep {tmp3 = load}
-define i32 @f(i32* nocapture %p, i32 %n) nounwind {
+@p = external global i32
+define i32 @f(i32 %n) nounwind {
entry:
br label %for.cond
@@ -13,9 +14,9 @@ for.cond.for.end_crit_edge: ; preds = %for.cond
br label %for.end
for.body: ; preds = %for.cond
- %tmp3 = load i32* %p ; <i32> [#uses=1]
+ %tmp3 = load i32* @p ; <i32> [#uses=1]
%dec = add i32 %tmp3, -1 ; <i32> [#uses=2]
- store i32 %dec, i32* %p
+ store i32 %dec, i32* @p
%cmp6 = icmp slt i32 %dec, 0 ; <i1> [#uses=1]
br i1 %cmp6, label %for.body.for.end_crit_edge, label %for.inc
@@ -27,6 +28,6 @@ for.inc: ; preds = %for.body
br label %for.cond
for.end: ; preds = %for.body.for.end_crit_edge, %for.cond.for.end_crit_edge
- %tmp9 = load i32* %p ; <i32> [#uses=1]
+ %tmp9 = load i32* @p ; <i32> [#uses=1]
ret i32 %tmp9
}