[PATCH] D9403: llvm.noalias - Clang CodeGen for local restrict-qualified pointers

Hal Finkel via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 14:38:20 PDT 2016

hfinkel added inline comments.

Comment at: lib/CodeGen/CGStmt.cpp:537
@@ +536,3 @@
+                                      llvm::LLVMContext::MD_noalias),
+                                      NewScopeList));
rjmccall wrote:
> This is a very strange representation.  Every memory operation in the lexical block is annotated with a list of all of the scopes that were entered within the block, even if they were entered after the operation.  But for some reason, not with nested scopes?
> What's the right patch for me to read about this representation?
Perhaps unfortunately, this is an artifact of the way that restrict is defined in C. It applies to all accesses in the block in which the variable is declared, even those before the declaration of the restrict-qualified local itself.

It should work with nested scopes, in the sense that we add these things as we complete each scope. So we add things to the inner scope, and then when we complete the outer scope, we go back over the instructions (including those in the inner scope because the scope recording recurses up the scope hierarchy), and adds the outer scopes - it concatenates them to any added by the inner (nested) scopes.

The noalias intrinsic's LangRef updates are in D9375.


More information about the cfe-commits mailing list