[llvm] [CGP] Do not eliminate blocks which have their address taken (PR #163962)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 17 14:54:05 PDT 2025


https://github.com/efriedma-quic commented:

If a basic block is eliminated before codegen (or before the last IR module pass in the codegen pipeline), there isn't a problem because nothing holds onto the reference.

We have infrastructure for dealing with basic blocks that get eliminated after isel (see AsmPrinter::emitFunctionBody).

And if a block gets eliminated between the start of codegen and isel, we have some code that's supposed to deal with it.  See AddrLabelMap::takeDeletedSymbolsForFunction in AsmPrinter.cpp. (see also db035a0af2ac5dfbefe952a874903b08d9b48152).  This is supposed to handle testcases like #161164.  If that code isn't functioning correctly, we should fix it.

Trying to prevent any codegen IR pass from making code unreachable is way too much work, and impossible to maintain long-term.

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


More information about the llvm-commits mailing list