summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 85c1dc4ec87..e570e98df87 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -1181,10 +1181,14 @@ static bool replaceMathCmpWithIntrinsic(BinaryOperator *BO, CmpInst *Cmp,
if (!MathDominates && !DT.dominates(Cmp, BO))
return false;
- // Check that the insertion doesn't create a value that is live across more
- // than two blocks, so to minimise the increase in register pressure.
BasicBlock *MathBB = BO->getParent(), *CmpBB = Cmp->getParent();
if (MathBB != CmpBB) {
+ // Avoid hoisting an extra op into a dominating block and creating a
+ // potentially longer critical path.
+ if (!MathDominates)
+ return false;
+ // Check that the insertion doesn't create a value that is live across
+ // more than two blocks, so to minimise the increase in register pressure.
BasicBlock *Dominator = MathDominates ? MathBB : CmpBB;
BasicBlock *Dominated = MathDominates ? CmpBB : MathBB;
auto Successors = successors(Dominator);
OpenPOWER on IntegriCloud