[PATCH] D132022: [SCEVExpander] Drop poison-generating flags on hoisting. PR57187

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 22:34:56 PDT 2022


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:1056
+    // Drop flags that are potentially inferred from old context.
+    I->dropPoisonGeneratingFlags();
   }
----------------
fhahn wrote:
> This seems too pessimistic and unnecessarily drops flags that are not inferred based on the context instruction, e.g. because the original IV already had `nuw/nsw`.
> 
> Would it be possible to preserve the flags valid at entry of the loop when hoisting?
We can't do it here. But I guess this is mostly used in IndVars, and we can further strengthen no-wrap flags after this hoisting, if it happened. Didn't try it and don't know the consequences. Can it go as separate patch?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132022/new/

https://reviews.llvm.org/D132022



More information about the llvm-commits mailing list