[PATCH] D52575: [SimplifyCFG] Pass AggressiveInsts to DominatesMergePoint by reference. Remove null check.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 16:42:25 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL343828: [SimplifyCFG] Pass AggressiveInsts to DominatesMergePoint by reference. Removeā€¦ (authored by ctopper, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52575?vs=167199&id=168409#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52575

Files:
  llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp


Index: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -326,7 +326,7 @@
 /// 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 @@
   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 @@
   // 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 @@
                              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 @@
       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;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52575.168409.patch
Type: text/x-patch
Size: 2367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181004/d9f64024/attachment.bin>


More information about the llvm-commits mailing list