[PATCH] D125904: [Cuda] Use fallback method to mangle externalized decls if no CUID given
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 24 09:45:44 PDT 2022
jhuber6 added inline comments.
================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:6845-6846
+ llvm::MD5::MD5Result Result;
+ for (const auto &Arg : PreprocessorOpts.Macros)
+ Hash.update(Arg.first);
+ Hash.final(Result);
----------------
yaxunl wrote:
> jhuber6 wrote:
> > yaxunl wrote:
> > > Are these options always the same for device and host compilation?
> > >
> > > If not, this may not work since host and device compilation will have different names for the same variable.
> > This should only be definitions passed to the front-end via `-D`. There's a handful of these that the Clang driver will pass in, e.g. `-D__GCC_HAVE_DWARF2_CFI_ASM=1`, but as far as I know it's consistent between host and device compilations.
> Can we add a comment here saying that this requires that device offloading toolchain does not add preprocessor arguments to clang? This is a hidden requirement.
Yeah, it's a bit of a hidden requirement. Most toolchains add specific macros via the regular macro builder so this has worked for the configurations I've tested. I'll add a comment for it so it's at least mentioned more explicitly.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125904/new/
https://reviews.llvm.org/D125904
More information about the cfe-commits
mailing list