[PATCH] D19730: [BasicAA] Treat llvm.assume as not accessing memory in getModRefBehavior(Function)

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 10:57:24 PDT 2016


----- Original Message -----

> From: "Daniel Berlin" <dberlin at dberlin.org>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "Geoff Berry" <gberry at codeaurora.org>, "Chandler Carruth"
> <chandlerc at gmail.com>, "Philip Reames" <listmail at philipreames.com>,
> "Sanjoy Das" <sanjoy at playingwithpointers.com>,
> mcrosier at codeaurora.org, "llvm-commits"
> <llvm-commits at lists.llvm.org>, "Junbum Lim"
> <junbuml at codeaurora.org>,
> reviews+D19730+public+66d50dddcf8372b8 at reviews.llvm.org
> Sent: Friday, April 29, 2016 12:31:28 PM
> Subject: Re: [PATCH] D19730: [BasicAA] Treat llvm.assume as not
> accessing memory in getModRefBehavior(Function)

> > I'm not sure this is a good idea. As the comment says, they "never
> > aliases any particular memory location". This, however, is not
> > comparing against any particular location.
> 
> > It is asking for general behavior.
> 
> Yes, and it neither mod nor refs anything :)

> > AA should probably be constant with the function attributes here.
> 

> BasicAA already was working around this.
I know, I'm responsible for the workarounds. 

> This just puts this knowledge in one place instead of two (basicaa
> and memoryssa).

> In any case, if we are going to do that, we'd have to actually fix
> things properly. Saying assume has side-effects and writes things
> was wrong in the first place compared to actually modeling control
> dependencies for things like assume properly.

> It simply does not have side-effects or write anything. Period.
> Claiming otherwise is a lie to try to avoid fixing other
> infrastructure to handle this kind of intrinsic properly.

> Until we go and have the wherewithal to fix that infrastructure, we
> are going to have to accept that we are going to have things like
> this, where we are making up for it.
I'm well aware of the state of things, and I agree that we should have a better way of modeling control dependencies than via memory. 

> The alternative, which was currently done, where basicaa and
> memoryssa and whoever else has to know that assume is magic and
> special, seems much worse.

I understand. However, without our current system, this still obviously needs to be correct. What is to prevent a pass from (correctly) seeing the call to assume, using AA to conclude it does not actually alter memory, seeing it has no return values, intrinsics don't throw, and so removing it as dead? It might have control-dependent UB, but not if it is removed. 

-Hal 

-- 

Hal Finkel 
Assistant Computational Scientist 
Leadership Computing Facility 
Argonne National Laboratory 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160429/96d68cfb/attachment.html>


More information about the llvm-commits mailing list