[PATCH] D149451: [NVPTX] Add NVPTXCtorDtorLoweringPass to handle global ctors / dtors

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 1 13:30:09 PDT 2023


jhuber6 added inline comments.


================
Comment at: llvm/lib/Target/NVPTX/NVPTXCtorDtorLowering.cpp:58
+        ((IsCtor ? "__init_array_object_" : "__fini_array_object_") +
+         F->getName() + "_" + getHash(M.getName()) + "_" +
+         std::to_string(Priority))
----------------
tra wrote:
> Source file name may be a little bit better, though it's still easy to clash if someone does `cd A; clang ./foo.c; cd ../B; clang ./foo.c` and the file name uses relative paths.
> 
> I think we'll need a way to override this unique suffix explicitly as an escape hatch for cases where someone runs into a clash.
I figured it'd be good enough since this is admittedly *very* niche. So someone would need to have a file called `foo.c` that also had a constructor called `foo` in it. For it to clash. Isn't it too late to grab the source filename while we're in the backend lowering stage?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149451/new/

https://reviews.llvm.org/D149451



More information about the cfe-commits mailing list