diff options
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)); } |