[llvm] [SimplifyIndVar] Push more users to worklist for simplifyUsers (PR #93598)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 24 04:54:49 PDT 2024
================
@@ -854,16 +861,23 @@ static void pushIVUsers(
if (UI == Def)
continue;
- // Only change the current Loop, do not change the other parts (e.g. other
- // Loops).
- if (!L->contains(UI))
+ // Avoid adding Defs that SCEV expand to themselves, e.g. the LoopPhis
+ // of the outter loops.
+ if (!DT->dominates(L->getHeader(), UI->getParent()))
continue;
// Do not push the same instruction more than once.
if (!Simplified.insert(UI).second)
continue;
- SimpleIVUsers.push_back(std::make_pair(UI, Def));
+ unsigned Counter =
+ L->contains(UI)
+ ? 0 // reset depth if we go back inside the loop.
+ : OutOfLoopChainCounter + (UI->getParent() != Def->getParent());
----------------
v01dXYZ wrote:
At first, I implemented a instruction-wise depth but I changed that as I visualised the algorithm at the CFG level, as accepting optimising basic blocks that are at given distance of the loop `dist(Loop, BB) < limit`.
Also, I didn't like the idea to have partially optimised basic-blocks.
https://github.com/llvm/llvm-project/pull/93598
More information about the llvm-commits
mailing list