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

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 11 08:06:34 PDT 2017

yaxunl added inline comments.

Comment at: lib/CodeGen/TargetInfo.cpp:7291
+  Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD,
+      CodeGen::CodeGenFunction &CGF) const override;
rjmccall wrote:
> How about, instead of introducing a second method, we just change performAddrSpaceCast to take two AST address spaces and a flag indicating whether the address is known to be non-null?  Does your target have an AST-level address space for the stack?
In both AST and LLVM, the destination pointee type of address space cast may be different from the source pointee type (e.g. `addrspacecast i32 addrspace(1)* %a to i8 addrspace(4)*` is valid LLVM instruction), so performAddrSpaceCast needs to know the destination QualType, not just the address space.


More information about the cfe-commits mailing list