[llvm-commits] [llvm] r44068 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp

Chris Lattner sabre at nondot.org
Tue Nov 13 13:46:23 PST 2007


Author: lattner
Date: Tue Nov 13 15:46:23 2007
New Revision: 44068

URL: http://llvm.org/viewvc/llvm-project?rev=44068&view=rev
Log:
Fix the regression on Transforms/GlobalOpt/deadglobal-2.ll from my
patch on friday.

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=44068&r1=44067&r2=44068&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Tue Nov 13 15:46:23 2007
@@ -345,14 +345,14 @@
       // Do not transform "gepinst (gep constexpr (GV))" here, because forming
       // "gepconstexpr (gep constexpr (GV))" will cause the two gep's to fold
       // and will invalidate our notion of what Init is.
+      Constant *SubInit = 0;
       if (!isa<ConstantExpr>(GEP->getOperand(0))) {
         ConstantExpr *CE = 
           dyn_cast_or_null<ConstantExpr>(ConstantFoldInstruction(GEP));
         if (Init && CE && CE->getOpcode() == Instruction::GetElementPtr)
-          if (Constant *SubInit = 
-              ConstantFoldLoadThroughGEPConstantExpr(Init, CE))
-            Changed |= CleanupConstantGlobalUsers(GEP, SubInit);
+          SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE);
       }
+      Changed |= CleanupConstantGlobalUsers(GEP, SubInit);
 
       if (GEP->use_empty()) {
         GEP->eraseFromParent();





More information about the llvm-commits mailing list