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

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 15 17:37:12 PDT 2016

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

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?

-- Sanjoy

More information about the llvm-dev mailing list