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

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 28 11:11:48 PDT 2024


duk-37 wrote:

> > That would be a change in the instruction selection backend though, not disabling this pass altogether
> 
> I thought this pass added the `exit` instruction, not instruction selection. Assuming I'm missing something, where should we make this change within the instruction selection?
> 

Sorry, I probably added some confusion with the way I worded things. What I was saying is that, if the reason this pass exists is to avoid bogus CFG edges (which makes sense, especially if there are downstream optimizations happening) then it either:
1. should stay as-is, or;
2. `TrapUnreachable` + `NoTrapAfterNoreturrn` could be set to true/false respectively in order to fix the issue in pretty much the same way, just without the extra pass.

The introduction of the pass happened to be due to a miscompile because of bogus CFG edges, but even if that's been fixed it's still probably a useful hint to any compilers taking this output as input like @maleadt said.

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


More information about the llvm-commits mailing list