[PATCH] D135832: Do not append terminating NUL to the string with embedded GPU binary.
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 14 16:18:49 PDT 2022
tra added inline comments.
================
Comment at: clang/lib/CodeGen/CGCUDANV.cpp:95
llvm::ConstantInt::get(SizeTy, 0)};
- auto ConstStr = CGM.GetAddrOfConstantCString(Str, Name.c_str());
+ auto ConstStr = CGM.GetAddrOfConstantCString(Str, Name.c_str(), AddNull);
llvm::GlobalVariable *GV =
----------------
efriedma wrote:
> Please don't abuse GetAddrOfConstantCString like this. Like the name says, it's meant for strings, in the normal sections strings would go in. If you just want an array global, please just use "new llvm::GlobalVariable" directly.
>
> (AddNull itself is not a big deal, but messing with the section/alignment/unnamed_addr of globals in CodeGenModule's ConstantStringMap is a bad idea.)
Agreed. That was not the best choice. I've separated generation of regular strings from generation of constant arrays we need to place just so.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135832/new/
https://reviews.llvm.org/D135832
More information about the cfe-commits
mailing list