Fix Transforms/GlobalOpt/2007-05-13-Crash.ll
authorChris Lattner <sabre@nondot.org>
Sun, 13 May 2007 21:28:07 +0000 (21:28 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 13 May 2007 21:28:07 +0000 (21:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37020 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/GlobalOpt.cpp

index f5d2baa426a68c649180c7446cd3dc85c53df8b0..56f6390ea4b55cbe5e6bccbb771180cfbe03b111 100644 (file)
@@ -623,7 +623,10 @@ static bool OptimizeAwayTrappingUsesOfLoads(GlobalVariable *GV, Constant *LV) {
       Loads.push_back(LI);
       Changed |= OptimizeAwayTrappingUsesOfValue(LI, LV);
     } else {
-      assert(isa<StoreInst>(*GUI) && "Only expect load and stores!");
+      // If we get here we could have stores, loads, or phi nodes whose values
+      // are loaded.
+      assert((isa<StoreInst>(*GUI) || isa<PHINode>(*GUI)) &&
+             "Only expect load and stores!");
     }
 
   if (Changed) {