[PATCH] D124697: Distinguish between different forms of "address-taken" MachineBasicBlocks

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 11:33:59 PDT 2022


efriedma added a comment.

The way things currently work, the significant thing is whether the block is actually referred to by a blockaddress constant.  isel doesn't actually check whether the block is the target of an indirectbr.  So the naming reflects the current behavior; we treat the block as "address-taken" based on whether there's a blockaddress.

Given the LangRef rules, blocks that have an blockaddress pointing at them are generally also the target of an indirectbr, but we don't actually enforce that anywhere.

The LangRef rule is written the way it is to avoid promising anything about the way blockaddress constants are lowered.  For example, if a block is unreachable, we can replace the associated blockaddress constant with a constant "1".  Or on some targets like wasm, we convert indirectbrs to switches because we can't jump to arbitrary addresses.  (We could implement an optimization to explicitly eliminate blockaddresses that refer to blocks that don't have an indirectbr predecessor... but it's not really important, so nobody has.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124697/new/

https://reviews.llvm.org/D124697



More information about the llvm-commits mailing list