diff options
author | James Molloy <james.molloy@arm.com> | 2016-09-02 07:29:00 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2016-09-02 07:29:00 +0000 |
commit | f3cf2a494be6aeb52ee323a2f30c63d212afbd5b (patch) | |
tree | a38d7d3dbc8483967b7373820bbaa06601dd26f8 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 3121ddf7fabef34e6876fc46dc243b125dd31b8e (diff) | |
download | llvm-f3cf2a494be6aeb52ee323a2f30c63d212afbd5b.zip llvm-f3cf2a494be6aeb52ee323a2f30c63d212afbd5b.tar.gz llvm-f3cf2a494be6aeb52ee323a2f30c63d212afbd5b.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: 280470
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 81d1705..6fe00a7 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1425,6 +1425,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)); } |