[PATCH] D46643: CodeGen: Emit string literal in constant address space
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 9 12:05:00 PDT 2018
yaxunl marked an inline comment as done.
yaxunl added inline comments.
================
Comment at: lib/CodeGen/CGDecl.cpp:1375
+ Loc = Address(EmitCastToVoidPtrInAllocaAddrSpace(Loc.getPointer()),
+ Loc.getAlignment());
----------------
rjmccall wrote:
> I don't understand why a patch about string literals is changing auto variable emission.
It is a bug about alloca revealed by the lit test
```
char l_array[] = "l_array";
```
Loc contains the alloca casted to default address space, therefore it needs to be casted back to alloca address space here, otherwise CreateBitCast returns invalid bitcast. Unlike lifetime.start, memcpy does not require alloca address space, so an alternative fix is to let BP take address space of Loc.
https://reviews.llvm.org/D46643
More information about the cfe-commits
mailing list