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.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 68bab28c0b7..85c1dc4ec87 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -1183,9 +1183,10 @@ static bool replaceMathCmpWithIntrinsic(BinaryOperator *BO, CmpInst *Cmp,
// 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.
- if (BO->getParent() != Cmp->getParent()) {
- BasicBlock *Dominator = MathDominates ? BO->getParent() : Cmp->getParent();
- BasicBlock *Dominated = MathDominates ? Cmp->getParent() : BO->getParent();
+ BasicBlock *MathBB = BO->getParent(), *CmpBB = Cmp->getParent();
+ if (MathBB != CmpBB) {
+ BasicBlock *Dominator = MathDominates ? MathBB : CmpBB;
+ BasicBlock *Dominated = MathDominates ? CmpBB : MathBB;
auto Successors = successors(Dominator);
if (llvm::find(Successors, Dominated) == Successors.end())
return false;
OpenPOWER on IntegriCloud