diff options
author | James Molloy <james.molloy@arm.com> | 2016-08-31 10:46:45 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2016-08-31 10:46:45 +0000 |
commit | 171fdac7ced51500b9cde465afe5b7f8ac832fe1 (patch) | |
tree | 7dbb8af8226ce8f47801bfb4536be94dd5094b45 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 8e69b032e5e13e1f8f9ebd8e1ee20643b6e6bf8b (diff) | |
download | llvm-171fdac7ced51500b9cde465afe5b7f8ac832fe1.zip llvm-171fdac7ced51500b9cde465afe5b7f8ac832fe1.tar.gz llvm-171fdac7ced51500b9cde465afe5b7f8ac832fe1.tar.bz2 |
[SimplifyCFG] Add a workaround to fix PR30188
We're sinking stores, which is a good thing, but in the process creating selects for the store address operand, which SROA/Mem2Reg can't look through, which caused serious regressions.
The real fix is in SROA, which I'll be looking into.
llvm-svn: 280219
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 3404a4d..3de6c60 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1424,6 +1424,16 @@ static bool canSinkInstructions( // FIXME: if the call was *already* indirect, we should do this. 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. + // 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) && + any_of(Insts, [](const Instruction *I) { + return isa<AllocaInst>(I->getOperand(1)); + })) + return false; for (auto *I : Insts) PHIOperands[I].push_back(I->getOperand(OI)); } |