[llvm] [SimplifyIndVar] Push more users to worklist for simplifyUsers (PR #93598)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 24 02:33:28 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());
----------------
nikic wrote:
Why is this a limit on the depth of the blocks rather than instructions? You can have a very long chain of instructions within a single block, or a very short one across blocks. It seems like that would be the more relevant quantity.
https://github.com/llvm/llvm-project/pull/93598
More information about the llvm-commits
mailing list