[llvm] [InstCombine] Re-queue users of phi when nsw/nuw flags of add are inferred (PR #113933)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 16:53:14 PDT 2024
================
@@ -1868,6 +1868,13 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
if (Instruction *Res = foldBinOpOfSelectAndCastOfSelectCondition(I))
return Res;
+ if (Changed) {
+ for (User *U : I.users()) {
+ if (auto *PHI = dyn_cast<PHINode>(U))
+ Worklist.pushUsersToWorkList(*PHI);
+ }
+ }
----------------
dtcxzyw wrote:
> I don't quite understand why this isn't already handled by pushUsersToWorkList in the normal InstCombine loop
Take the above case as an example. If the add instruction is updated, `%iv` and `%phi` will be re-queued. But `%cmp` cannot be re-queued since we do not change `%iv`.
https://github.com/llvm/llvm-project/pull/113933
More information about the llvm-commits
mailing list