summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-10-04 23:40:31 +0000
committerCraig Topper <craig.topper@intel.com>2018-10-04 23:40:31 +0000
commit029d1ef6ebe65280d675d8bccb33a5222f8b5efb (patch)
tree3ad6dfa1a274882847ed82441421e8332b2df127
parent409b4391527a72d8c606749386a079aa42437f57 (diff)
downloadbcm5719-llvm-029d1ef6ebe65280d675d8bccb33a5222f8b5efb.tar.gz
bcm5719-llvm-029d1ef6ebe65280d675d8bccb33a5222f8b5efb.zip
[SimplifyCFG] Pass AggressiveInsts to DominatesMergePoint by reference. Remove null check.
Summary: At some point in the past the recursion in DominatesMergePoint used to pass null for AggressiveInsts as part of the recursion. It no longer does this. So there is no way for AggressiveInsts to be null. This passes it by reference and removes the null check to make this explicit. Reviewers: efriedma, reames Reviewed By: efriedma Subscribers: xbolva00, llvm-commits Differential Revision: https://reviews.llvm.org/D52575 llvm-svn: 343828
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 5e972b16e28..ebbcf800254 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -326,7 +326,7 @@ static unsigned ComputeSpeculationCost(const User *I,
/// V plus its non-dominating operands. If that cost is greater than
/// CostRemaining, false is returned and CostRemaining is undefined.
static bool DominatesMergePoint(Value *V, BasicBlock *BB,
- SmallPtrSetImpl<Instruction *> *AggressiveInsts,
+ SmallPtrSetImpl<Instruction *> &AggressiveInsts,
unsigned &CostRemaining,
const TargetTransformInfo &TTI,
unsigned Depth = 0) {
@@ -360,13 +360,8 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB,
if (!BI || BI->isConditional() || BI->getSuccessor(0) != BB)
return true;
- // If we aren't allowing aggressive promotion anymore, then don't consider
- // instructions in the 'if region'.
- if (!AggressiveInsts)
- return false;
-
// If we have seen this instruction before, don't count it again.
- if (AggressiveInsts->count(I))
+ if (AggressiveInsts.count(I))
return true;
// Okay, it looks like the instruction IS in the "condition". Check to
@@ -384,7 +379,7 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB,
// is expected to be undone in CodeGenPrepare if the speculation has not
// enabled further IR optimizations.
if (Cost > CostRemaining &&
- (!SpeculateOneExpensiveInst || !AggressiveInsts->empty() || Depth > 0))
+ (!SpeculateOneExpensiveInst || !AggressiveInsts.empty() || Depth > 0))
return false;
// Avoid unsigned wrap.
@@ -397,7 +392,7 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB,
Depth + 1))
return false;
// Okay, it's safe to do this! Remember this instruction.
- AggressiveInsts->insert(I);
+ AggressiveInsts.insert(I);
return true;
}
@@ -2315,9 +2310,9 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI,
continue;
}
- if (!DominatesMergePoint(PN->getIncomingValue(0), BB, &AggressiveInsts,
+ if (!DominatesMergePoint(PN->getIncomingValue(0), BB, AggressiveInsts,
MaxCostVal0, TTI) ||
- !DominatesMergePoint(PN->getIncomingValue(1), BB, &AggressiveInsts,
+ !DominatesMergePoint(PN->getIncomingValue(1), BB, AggressiveInsts,
MaxCostVal1, TTI))
return false;
}
OpenPOWER on IntegriCloud