[llvm-dev] ScalarEvolution "add nsw" question

Bjarke Roune via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 12 12:05:56 PDT 2016


Hi Johannes,

Sanjoy has given you great information already.

On Sun, Apr 10, 2016 at 5:19 PM, Sanjoy Das <sanjoy at playingwithpointers.com>
wrote:

> Johannes Doerfert wrote:
> > Is there any plan to use e.g., post-dominance information to
> > propagate wrapping flags?
>
> None that I'm aware of.
>
> > If x +nsw y post-dominates the entry block
> > [and is used in some side-effect instruction] the SCEV could be marked
> > as non-wrapping, couldn't it?
>
> Yes, but we have to be careful to account for exceptions, infinitely
> looping functions, exit(0) etc.  I.e. in
>
> void foo() {
>   use(x + y);
>   exit(0);
>   use(x +nsw y);
> }
>
> the nsw in the later x+y cannot be transferred to the former x+y
> (assume use is a side effecting use).
>
> The code I wrote to handle this could be made more powerful, e.g. by
introducing an analysis pass for strong post-dominance (as opposed to the
usual kind of post-dominance). There was a brief amount of discussion on
this a while back:

  https://groups.google.com/forum/#!topic/llvm-dev/CBJY51__wOE

I don't know if there's been any developments on that since then.

Bjarke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160412/7ed21a02/attachment.html>


More information about the llvm-dev mailing list