Some targets have constant address space (e.g. amdgcn). For them string literal should be
emitted in constant address space then casted to default address space.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
The part about string literals looks fine, but:
lib/CodeGen/CGDecl.cpp | ||
---|---|---|
1375 | I don't understand why a patch about string literals is changing auto variable emission. |
lib/CodeGen/CGDecl.cpp | ||
---|---|---|
1375 | 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. |
lib/CodeGen/CGDecl.cpp | ||
---|---|---|
1375 | Yeah, I think using the address space of Loc is more appropriate. |
CGM.Int8Ty exists.