[PATCH] D146429: [LSR] Fix wrapping bug in lsr-term-fold logic

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 12:07:52 PDT 2023

reames added inline comments.

Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:6789
+    if (NoOverflowBitWidth > ARBitWidth)
+      return nullptr;
reames wrote:
> nikic wrote:
> > Hm, can't we do something like check the nowrap (as in `<nw>`) flag on the post-inc addrec here?
> I think you might be on to something here.  Let me give this a bit more thought and see if I can find a counter example.
I tried this out, and on simple tests (e.g. const_tripcount for this transform), we appear to not be inferring no-self-wrap.  I think we should, but it looks like we've got some inference problems here.

Mind if I go forward with the current scheme?  I'd really like to get this transform into a somewhat sound state.  

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list