[llvm-commits] [llvm] r45568 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2008-01-03-Crash.ll

Chris Lattner sabre at nondot.org
Thu Jan 3 21:04:53 PST 2008


Author: lattner
Date: Thu Jan  3 23:04:53 2008
New Revision: 45568

URL: http://llvm.org/viewvc/llvm-project?rev=45568&view=rev
Log:
Fix PR1896

Added:
    llvm/trunk/test/Transforms/GlobalOpt/2008-01-03-Crash.ll
Modified:
    llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp

Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=45568&r1=45567&r2=45568&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Thu Jan  3 23:04:53 2008
@@ -640,7 +640,7 @@
       // If we get here we could have stores, selects, or phi nodes whose values
       // are loaded.
       assert((isa<StoreInst>(*GUI) || isa<PHINode>(*GUI) ||
-              isa<SelectInst>(*GUI)) &&
+              isa<SelectInst>(*GUI) || isa<ConstantExpr>(*GUI)) &&
              "Only expect load and stores!");
     }
 

Added: llvm/trunk/test/Transforms/GlobalOpt/2008-01-03-Crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/2008-01-03-Crash.ll?rev=45568&view=auto

==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/2008-01-03-Crash.ll (added)
+++ llvm/trunk/test/Transforms/GlobalOpt/2008-01-03-Crash.ll Thu Jan  3 23:04:53 2008
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis
+; PR1896
+
+ at indirect1 = internal global void (i32)* null		; <void (i32)**> [#uses=2]
+
+declare void @indirectmarked(i32)
+
+define i32 @main() {
+entry:
+	br i1 false, label %cond_next20.i, label %cond_true.i9
+
+cond_true.i9:		; preds = %entry
+	ret i32 0
+
+cond_next20.i:		; preds = %entry
+	store void (i32)* @indirectmarked, void (i32)** @indirect1, align 4
+	br i1 false, label %cond_next21.i.i23.i, label %stack_restore
+
+stack_restore:		; preds = %cond_next20.i
+	ret i32 0
+
+cond_next21.i.i23.i:		; preds = %cond_next20.i
+	%tmp6.i4.i = load i32* bitcast (void (i32)** @indirect1 to i32*), align 4		; <i32> [#uses=0]
+	ret i32 0
+}
+





More information about the llvm-commits mailing list