[clang] [llvm] [TargetParser][PGO] NVPTX does not support COMDAT (PR #245705)

Joel E. Denny via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 12:01:47 PST 2026


================
@@ -1286,8 +1286,12 @@ class Triple {
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
+    // NVPTX is formatted as ELF, which does support COMDAT, unlike the other
+    // formats listed here.  However, it is compiled to PTX, assembled by ptxas
+    // into a cubin, which is linked by nvlink, and neither of those tools
+    // honors COMDAT.
     return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||
-             isOSBinFormatDXContainer());
+             isOSBinFormatDXContainer() || isNVPTX());
----------------
jdenny-ornl wrote:

I agree that would seem cleaner here given that the other cases in this list are object formats.  However, I imagine there are many other checks for ELF that would then need to also check for PTX, and that feels like a potentially large NFC change that should be separate.  I don't have a lot of experience in this part of the code base, so what do you think?  Can that come later?

https://github.com/llvm/llvm-project/pull/245705


More information about the cfe-commits mailing list