Honestly, i don't know what should happen when we want to delete
a block that has their address taken.
Currently, when that happens, the i8* blockaddress(@fun, %bb)
is replaced with i8* inttoptr i32 1 to i8*. Which is obviously
no longer an address of a block, and iff the use semantically required
it to actually be an address of a block, e.g. AArch64's S constaint
in llvm/test/CodeGen/AArch64/inlineasm-S-constraint.ll,
then the IR suddenly becomes invalid.
I have only noticed this because that test starts to fail
after some SimplifyCFG changes.
So, since, the blocks practically never have their addresses taken,
i would propose to:
- forbid DeleteDeadBlocks() from deleting blocks that have their addresses taken. This will allow to catch the precise codepath that is missing aa precondition.
- Don't delete blocks that have their addresses taken
- Allow to delete unreachable that have their addresses taken - taking an address does not count as block reachability.
Seems this test has always highlighted the broken behaviour :( should have caught that in review...