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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 12:35:47 PDT 2023


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:6789
+    if (NoOverflowBitWidth > ARBitWidth)
+      return nullptr;
+
----------------
reames wrote:
> 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.  
Yeah, I'm fine with that, thanks for checking.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146429



More information about the llvm-commits mailing list