[llvm-dev] RFC: Strong GC References in LLVM

Andrew Trick via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 15 17:40:51 PDT 2016


> On Jul 15, 2016, at 5:37 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
> 
> Hi Andy,
> 
> Andrew Trick wrote:
> > At some point I stopped thinking about this as a bug and realized that
> > you just need to think of LLVM as modeling speculative code barriers as
> > memory dependence. In LLVM, it makes no sense to have a readonly
> > may-throw call.
> 
> The problem is that that model breaks down with aggressive aliasing
> like:
> 
> void foo(int* restrict ptr) {
>  *ptr = 40;
>  may_throw(); // read/write call
>  *ptr = 50;
> }
> 
> Now it is tempting to CSE the store of 40 to *ptr.  If we can't do
> that then what does restrict/noalias even mean?

I thought it meant ‘ptr’ doesn’t alias with other ‘restrict’ pointer args. Not that it’s an exclusive way to access the memory. I could be wrong though...

In the same way you can’t have readonly-maythrow, you wouldn’t have TBAA+maythrow. Yeah, it’s not great.

-Andy


More information about the llvm-dev mailing list