diff options
author | Chris Lattner <sabre@nondot.org> | 2007-11-13 21:46:23 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-11-13 21:46:23 +0000 |
commit | 19450241e5ca3f679251c29f4926bb5f12ed535f (patch) | |
tree | 5677cd2612e69e40c5cbe53992c6d2ad9239f30d /lib/Transforms/IPO/GlobalOpt.cpp | |
parent | 59ab338882f3b637abdc1f226ea296036afdbf83 (diff) | |
download | llvm-19450241e5ca3f679251c29f4926bb5f12ed535f.tar.gz llvm-19450241e5ca3f679251c29f4926bb5f12ed535f.tar.bz2 llvm-19450241e5ca3f679251c29f4926bb5f12ed535f.tar.xz |
Fix the regression on Transforms/GlobalOpt/deadglobal-2.ll from my
patch on friday.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44068 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 76f04efda6..f574ed4606 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -345,14 +345,14 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init) { // 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(); |