[llvm-branch-commits] [llvm-branch] r123012 - in /llvm/branches/Apple/whitney: lib/Analysis/BasicAliasAnalysis.cpp test/Analysis/BasicAA/global-size.ll

Daniel Dunbar daniel at zuster.org
Fri Jan 7 11:32:41 PST 2011


Author: ddunbar
Date: Fri Jan  7 13:32:41 2011
New Revision: 123012

URL: http://llvm.org/viewvc/llvm-project?rev=123012&view=rev
Log:
Merge r122772:
--
Author: Chris Lattner <clattner at apple.com>
Date:   Mon Jan 3 21:03:33 2011 +0000

    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/branches/Apple/whitney/lib/Analysis/BasicAliasAnalysis.cpp
    llvm/branches/Apple/whitney/test/Analysis/BasicAA/global-size.ll

Modified: llvm/branches/Apple/whitney/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Analysis/BasicAliasAnalysis.cpp?rev=123012&r1=123011&r2=123012&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/branches/Apple/whitney/lib/Analysis/BasicAliasAnalysis.cpp Fri Jan  7 13:32:41 2011
@@ -102,6 +102,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/branches/Apple/whitney/test/Analysis/BasicAA/global-size.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/test/Analysis/BasicAA/global-size.ll?rev=123012&r1=123011&r2=123012&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/test/Analysis/BasicAA/global-size.ll (original)
+++ llvm/branches/Apple/whitney/test/Analysis/BasicAA/global-size.ll Fri Jan  7 13:32:41 2011
@@ -14,3 +14,25 @@
         ret i16 %Z
 }
 
+; 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-branch-commits mailing list