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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 11 10:48:47 PDT 2017


rjmccall added inline comments.


================
Comment at: lib/CodeGen/TargetInfo.cpp:7291
+  Address adjustAddrSpaceForAutoVar(Address A, const VarDecl *VD,
+      CodeGen::CodeGenFunction &CGF) const override;
 };
----------------
yaxunl wrote:
> 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.
Is there any harm to generating separate cast instructions when this happens?


https://reviews.llvm.org/D32248





More information about the cfe-commits mailing list