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: > > 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? > They should be equivalent but the LLVM IR will be more verbose and take more > space, and LLVM passes will take more time since previously they only need to > process one instruction but now they need to process two instructions. > > The original representation is more concise, why should we change that to > emit two instructions instead of one instruction? It's a cleaner API. But fine, whatever, feel free to pass down an optional llvm::PointerType* for the destination type. https://reviews.llvm.org/D32248 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits