diff options
author | James Molloy <james.molloy@arm.com> | 2016-09-07 08:40:20 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2016-09-07 08:40:20 +0000 |
commit | ec905a62ae26fd3b2064a15e31b9988a8d32589a (patch) | |
tree | 9d73c434ff1ce7cd76461d4adec25af7890c9c44 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 42431e7ce7e41e8acf0b38465a73bebd6fd63751 (diff) | |
download | bcm5719-llvm-ec905a62ae26fd3b2064a15e31b9988a8d32589a.tar.gz bcm5719-llvm-ec905a62ae26fd3b2064a15e31b9988a8d32589a.zip |
[SimplifyCFG] Update workaround for PR30188 to also include loads
I should have realised this the first time around, but if we're avoiding sinking stores where the operands come from allocas so they don't create selects, we also have to do the same for loads because SROA will be just as defective looking at loads of selected addresses as stores.
Fixes PR30188 (again).
llvm-svn: 280792
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 6252169b83a..909a72c2afd 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1428,8 +1428,8 @@ static bool canSinkInstructions( return false; } // Because SROA can't handle speculating stores of selects, try not - // to sink stores of allocas when we'd have to create a PHI for the - // address operand. + // to sink loads or stores of allocas when we'd have to create a PHI for + // the address operand. // FIXME: This is a workaround for a deficiency in SROA - see // https://llvm.org/bugs/show_bug.cgi?id=30188 if (OI == 1 && isa<StoreInst>(I0) && @@ -1437,6 +1437,11 @@ static bool canSinkInstructions( return isa<AllocaInst>(I->getOperand(1)); })) return false; + if (OI == 0 && isa<LoadInst>(I0) && + any_of(Insts, [](const Instruction *I) { + return isa<AllocaInst>(I->getOperand(0)); + })) + return false; for (auto *I : Insts) PHIOperands[I].push_back(I->getOperand(OI)); } |