[llvm] [NVPTX] Only run LowerUnreachable when necessary (PR #109868)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 14:55:25 PDT 2024


================
@@ -368,9 +368,13 @@ void NVPTXPassConfig::addIRPasses() {
     addPass(createSROAPass());
   }
 
-  const auto &Options = getNVPTXTargetMachine().Options;
-  addPass(createNVPTXLowerUnreachablePass(Options.TrapUnreachable,
-                                          Options.NoTrapAfterNoreturn));
+  if (ST.hasPTXASUnreachableBug()) {
----------------
justinfargnoli wrote:

Topic for discussion: should this be a CLI option? 

I added the check for PTX Version <= 7.4 because it's the best proxy for querying whether `ptxas` comes from CUDA 11.4 or earlier I could find. (The highest version CUDA 11.4 `ptxas` supports is 7.4.)

Alternatively, we could put the onus on the user to set a flag indicating that they're using a copy of `ptxas` from CUDA 11.4 or prior. 

CC @Artem-B for comment. 

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


More information about the llvm-commits mailing list