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 | 68f04fa941779f6a5adce7f6857b43e77ecd9762 (patch) | |
tree | 039c029e5c11c1166cc152b13c48459836f423f6 /llvm/lib | |
parent | f150ace6cb8def11345f445ccaef9a1e305ee799 (diff) | |
download | bcm5719-llvm-68f04fa941779f6a5adce7f6857b43e77ecd9762.tar.gz bcm5719-llvm-68f04fa941779f6a5adce7f6857b43e77ecd9762.zip |
Fix the regression on Transforms/GlobalOpt/deadglobal-2.ll from my
patch on friday.
llvm-svn: 44068
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 76f04efda61..f574ed46063 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/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(); |