[llvm] Add Dead Block Elimination to NVVMReflect (PR #144171)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 17 14:20:46 PDT 2025


Artem-B wrote:

> with llc -O0 you will leave behind a ptx instruction that is illegal for the subtarget.

OK. That's a good point.

But. How is incorporating DCE into NVVMReflect pass better than running the existing  DCE pass right after reflect, regardless of the optimization level? You can not avoid the fact that to solve the problem, you do need to run DCE one way or another. We may as well just run the existing DCE pass and avoid duplicating the functionality.

The second-order problem is that unconditionally running DCE may not be universally desirable. After all, if the user explicitly specifies `-O0`, they presumably want to see no optimizations done. Considering that we've survived without needing a fix for this for about 10 years, I assume it's not a widespread issue at the moment. That is, unless that's about to change. Is it? 

In any case, it may be prudent to implement this as an optional feature, controlled by a command line option, if somebody really needs to enable or avoid DCE after reflect pass.


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


More information about the llvm-commits mailing list