[llvm] [InstCombine] Re-queue users of phi when nsw/nuw flags of add are inferred (PR #113933)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 16 13:06:55 PST 2024


================
@@ -1868,6 +1868,13 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
   if (Instruction *Res = foldBinOpOfSelectAndCastOfSelectCondition(I))
     return Res;
 
+  if (Changed) {
----------------
nikic wrote:

Sorry for not mentioning it earlier, but I think the cleanest way to do this is to use matchSimpleRecurrence to get the PHINode. If it's not a simple recurrence we're unlikely to get anything useful out of it anyway.

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


More information about the llvm-commits mailing list