[PATCH] D148244: [IRCE] Support inverted range check's predicate

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 00:28:30 PDT 2023


skatkov added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:374
+  // successor - outside it. Invert branch for opposite case
+  if (!L->contains(BI->getSuccessor(0)) && L->contains(BI->getSuccessor(1))) {
+    IRBuilder<> Builder(BI);
----------------
Can we move this transformation AFTER profitability check? The idea is that if we will not add this check to consideration, no need to do modification.

I guess it should work:
1) Get operand idx of edge coming to loop
2) use this operand number in getEdgeProbability
3) if we pass check, do transformation if operand idx != 0.


================
Comment at: llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:1901
 
   IRBuilder<> B(ExprInsertPt);
   for (InductiveRangeCheck &IRC : RangeChecks) {
----------------
Is it Dead variable?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148244/new/

https://reviews.llvm.org/D148244



More information about the llvm-commits mailing list