From f648125be9385a0d4abfd5e77ea3dd40694c4c07 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 19 Dec 2009 21:29:22 +0000 Subject: fix an overly conservative caching issue that caused memdep to cache a pointer as being unavailable due to phi trans in the wrong place. This would cause later queries to fail even when they didn't involve phi trans. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91787 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/GVN/rle-phi-translate.ll | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/Transforms/GVN') diff --git a/test/Transforms/GVN/rle-phi-translate.ll b/test/Transforms/GVN/rle-phi-translate.ll index 0a060fa..6731f43 100644 --- a/test/Transforms/GVN/rle-phi-translate.ll +++ b/test/Transforms/GVN/rle-phi-translate.ll @@ -112,3 +112,35 @@ bb2: ret i32 %dv } + + +; void test5(int N, double* G) { +; for (long j = 1; j < 1000; j++) +; G[j] = G[j] + G[j-1]; +; } +; +; Should compile into one load in the loop. +define void @test5(i32 %N, double* nocapture %G) nounwind ssp { +; CHECK: @test5 +bb.nph: + br label %for.body + +for.body: + %indvar = phi i64 [ 0, %bb.nph ], [ %tmp, %for.body ] + %arrayidx6 = getelementptr double* %G, i64 %indvar + %tmp = add i64 %indvar, 1 + %arrayidx = getelementptr double* %G, i64 %tmp + %tmp3 = load double* %arrayidx + %tmp7 = load double* %arrayidx6 + %add = fadd double %tmp3, %tmp7 + store double %add, double* %arrayidx + %exitcond = icmp eq i64 %tmp, 999 + br i1 %exitcond, label %for.end, label %for.body +; CHECK: for.body: +; CHECK: phi double +; CHECK: load double +; CHECK-NOT: load double +; CHECK: br i1 +for.end: + ret void +} -- cgit v1.1