[llvm] [NVPTX] Skip processing BasicBlocks with single unreachable instruction in `nvptx-lower-unreachable` pass. (PR #72641)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 01:24:10 PST 2024


================
@@ -138,7 +138,19 @@ bool NVPTXLowerUnreachable::runOnFunction(Function &F) {
   InlineAsm *Exit = InlineAsm::get(ExitFTy, "exit;", "", true);
 
   bool Changed = false;
-  for (auto &BB : F)
+
+  // In scenarios where a BasicBlock contains only one unreachable instruction,
+  // the joint action of nvptx-isel and unreachable-mbb-elimination
+  // effectively optimizes the BasicBlock out. However, adding an exit
+  // command to such a BasicBlock, as suggested by this pass, preserves it
+  // within the Control Flow Graph (CFG), thereby negatively impacting size and
+  // performance. To counteract this undesirable consequence, we choose to
+  // refrain from processing BasicBlocks with just one unreachable instruction
+  // in this pass.
+
----------------
mmoadeli wrote:

@maleadt , @Artem-B 
Given that this pass has introduced performance regression and the patch does not offer any evidence of a performance boost or resolution of a specific issue elsewhere, at this point, I think there's little left to be done. Hence, I recommend removing the problematic pass altogether since the proposed solutions to address performance issues of the pass have not satisfied reviewers.



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


More information about the llvm-commits mailing list