mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-22 20:20:03 +00:00
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
This commit is contained in:
parent
59ab338882
commit
19450241e5
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user