[llvm] [FunctionSpecializer] Do not mark function dead if any unexecutable call site exists (PR #154668)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 23 10:24:41 PDT 2025


XChy wrote:

Thanks for your detailed review.

> IIUC the fix correctly, you're suggesting to introduce specialization to those call-sites that live in basic blocks which were determined by the solver to be never executable.

Exactly, my original purpose is to avoid removing functions that are proven inexecutable but may be reset to be executable later.  New specialization is not my purpose.

> Isn't the discrepancy here stemming from the fact that we are attempting to remove basic blocks of a fully specialized function, where it should be up to FunctionSpecializer's destructor to remove such functions (in which case, unreachable call-sites should be removed as well)?

Sounds reasonable to me. It's the undefined behaviour that causes inconsistent executability. How about replacing the unreachable call-sites with `poison` and removing them? The return value of the once-proven-inexecutable call is invalid in fact.

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


More information about the llvm-commits mailing list