[PATCH] D32248: CodeGen: Cast alloca to expected address space

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 16 00:11:10 PDT 2017


rjmccall added inline comments.


================
Comment at: lib/CodeGen/CGDecl.cpp:1120
+        address.getPointer()->getType()->getPointerElementType()->getPointerTo(
+            getContext().getTargetAddressSpace(T.getAddressSpace())),
+        /*non-null*/ true);
----------------
A lot of this line can be address.getElementType().


================
Comment at: lib/CodeGen/CodeGenTypes.cpp:95
 
-
 /// isRecordLayoutComplete - Return true if the specified type is already
----------------
Did you intend to change this file?


================
Comment at: lib/CodeGen/TargetInfo.cpp:7296
+  unsigned getASTAllocaAddressSpace() const override {
+    return LangAS::Count + getABIInfo().getDataLayout().getAllocaAddrSpace();
+  }
----------------
Can we rename LangAS::Count to something more meaningful like LangAS::FirstTargetAddressSpace?  I think this would clarify a lot of code.

Is the OpenCL special case in ASTContext::getTargetAddressSpace still correct with this patch?  A pointer in LangAS::Default should be lowered as a generic pointer instead of a pointer into the alloca address space, right?


https://reviews.llvm.org/D32248





More information about the cfe-commits mailing list