[llvm] [SimplifyIndVar] Push more users to worklist for simplifyUsers (PR #93598)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 24 05:10:17 PDT 2024
================
@@ -942,11 +956,11 @@ void SimplifyIndvar::simplifyUsers(PHINode *CurrIV, IVVisitor *V) {
if ((isa<PtrToIntInst>(UseInst)) || (isa<TruncInst>(UseInst)))
for (Use &U : UseInst->uses()) {
Instruction *User = cast<Instruction>(U.getUser());
- if (replaceIVUserWithLoopInvariant(User))
+ if (DT->dominates(L->getHeader(), User->getParent()) &&
----------------
v01dXYZ wrote:
We checked `UseInst` is dominated but not its users.
We need this condition to "protect" the following call `replaceIVUserWithLoopInvariant` to ensure we don't feed it with a phi that is already invariant. It was not necessary before because the loop is LCSSA and any exits would be fenced with phis.
I could have misunderstood your point though.
https://github.com/llvm/llvm-project/pull/93598
More information about the llvm-commits
mailing list