aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/CodeGen/MachineLICM.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/MachineLICM.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/MachineLICM.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MachineLICM.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MachineLICM.cpp
index 500cf8e0b79b..00d75f8231c7 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/MachineLICM.cpp
@@ -240,7 +240,7 @@ namespace {
void ExitScopeIfDone(
MachineDomTreeNode *Node,
DenseMap<MachineDomTreeNode *, unsigned> &OpenChildren,
- DenseMap<MachineDomTreeNode *, MachineDomTreeNode *> &ParentMap);
+ const DenseMap<MachineDomTreeNode *, MachineDomTreeNode *> &ParentMap);
void HoistOutOfLoop(MachineDomTreeNode *HeaderN);
@@ -696,19 +696,16 @@ void MachineLICMBase::ExitScope(MachineBasicBlock *MBB) {
/// destroy ancestors which are now done.
void MachineLICMBase::ExitScopeIfDone(MachineDomTreeNode *Node,
DenseMap<MachineDomTreeNode*, unsigned> &OpenChildren,
- DenseMap<MachineDomTreeNode*, MachineDomTreeNode*> &ParentMap) {
+ const DenseMap<MachineDomTreeNode*, MachineDomTreeNode*> &ParentMap) {
if (OpenChildren[Node])
return;
- // Pop scope.
- ExitScope(Node->getBlock());
-
- // Now traverse upwards to pop ancestors whose offsprings are all done.
- while (MachineDomTreeNode *Parent = ParentMap[Node]) {
- unsigned Left = --OpenChildren[Parent];
- if (Left != 0)
+ for(;;) {
+ ExitScope(Node->getBlock());
+ // Now traverse upwards to pop ancestors whose offsprings are all done.
+ MachineDomTreeNode *Parent = ParentMap.lookup(Node);
+ if (!Parent || --OpenChildren[Parent] != 0)
break;
- ExitScope(Parent->getBlock());
Node = Parent;
}
}
@@ -999,6 +996,9 @@ bool MachineLICMBase::IsLICMCandidate(MachineInstr &I) {
if (I.isConvergent())
return false;
+ if (!TII->shouldHoist(I, CurLoop))
+ return false;
+
return true;
}