[llvm] [SimplifyIndVar] Push more users to worklist for simplifyUsers (PR #93598)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 10:17:36 PDT 2024


================
@@ -52,12 +52,11 @@ class IVVisitor {
 /// where the first entry indicates that the function makes changes and the
 /// second entry indicates that it introduced new opportunities for loop
 /// unswitching.
-std::pair<bool, bool> simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE,
-                                        DominatorTree *DT, LoopInfo *LI,
-                                        const TargetTransformInfo *TTI,
-                                        SmallVectorImpl<WeakTrackingVH> &Dead,
-                                        SCEVExpander &Rewriter,
-                                        IVVisitor *V = nullptr);
+std::pair<bool, bool>
+simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE, DominatorTree *DT,
+                  LoopInfo *LI, const TargetTransformInfo *TTI,
+                  SmallVectorImpl<WeakTrackingVH> &Dead, SCEVExpander &Rewriter,
+                  unsigned MaxDepthOutOfLoop = 1, IVVisitor *V = nullptr);
----------------
v01dXYZ wrote:

The question you raise is actually quite important as actually this code is disabled with this current default config. I disabled it as I wanted to make it optimisation level dependent but I needed some input to calibrate it according to the level.

It is set to `1` which means the set of BBs that will be affected are `dist(Loop, BB) < 1` (the strict bound is on purpose). The `0` value is a special value for an `+infinity` bound. 

+1 for making `pushIVUsers` a method instead of functions.

I think I'll put it to `0` now as it will show performance regressions and allow discussing about that. I'll add some tests before though.

https://github.com/llvm/llvm-project/pull/93598


More information about the llvm-commits mailing list