[llvm-commits] [llvm] r122772 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp test/Analysis/BasicAA/global-size.ll
Chris Lattner
sabre at nondot.org
Mon Jan 3 13:03:33 PST 2011
Author: lattner
Date: Mon Jan 3 15:03:33 2011
New Revision: 122772
URL: http://llvm.org/viewvc/llvm-project?rev=122772&view=rev
Log:
fix rdar://8813415 - a miscompilation of 164.gzip that loop-idiom
exposed. It turns out to be a latent bug in basicaa, scary.
Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
llvm/trunk/test/Analysis/BasicAA/global-size.ll
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=122772&r1=122771&r2=122772&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Jan 3 15:03:33 2011
@@ -103,6 +103,8 @@
const TargetData &TD) {
const Type *AccessTy;
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+ if (!GV->hasDefinitiveInitializer())
+ return false;
AccessTy = GV->getType()->getElementType();
} else if (const AllocaInst *AI = dyn_cast<AllocaInst>(V)) {
if (!AI->isArrayAllocation())
Modified: llvm/trunk/test/Analysis/BasicAA/global-size.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/global-size.ll?rev=122772&r1=122771&r2=122772&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/BasicAA/global-size.ll (original)
+++ llvm/trunk/test/Analysis/BasicAA/global-size.ll Mon Jan 3 15:03:33 2011
@@ -16,3 +16,25 @@
; CHECK: ret i16 0
}
+; Cannot know anything about the size of this global.
+; rdar://8813415
+ at window = external global [0 x i8]
+
+; CHECK: @test2
+define i8 @test2(i32 %tmp79, i32 %w.2, i32 %indvar89) nounwind {
+ %tmp92 = add i32 %tmp79, %indvar89
+ %arrayidx412 = getelementptr [0 x i8]* @window, i32 0, i32 %tmp92
+ %tmp93 = add i32 %w.2, %indvar89
+ %arrayidx416 = getelementptr [0 x i8]* @window, i32 0, i32 %tmp93
+
+ %A = load i8* %arrayidx412, align 1
+ store i8 4, i8* %arrayidx416, align 1
+
+ %B = load i8* %arrayidx412, align 1
+ %C = sub i8 %A, %B
+ ret i8 %C
+
+; CHECK: %B = load i8
+; CHECK: ret i8 %C
+}
+
More information about the llvm-commits
mailing list