[SimplifyCFG] HoistThenElseCodeToIf(): don't hoist if either block has it's address...
authorRoman Lebedev <lebedev.ri@gmail.com>
Sun, 20 Jun 2021 09:18:15 +0000 (12:18 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sun, 20 Jun 2021 09:18:15 +0000 (12:18 +0300)
commitad87761925c2790aab272138b5bbbde4a93e0383
tree24881b28ec1be296ff17017de69d52b6afa9b0c5
parent09e8c0d5aaef9f1157460a3ae6ae77c7a2f0966f
[SimplifyCFG] HoistThenElseCodeToIf(): don't hoist if either block has it's address taken

This problem is exposed by D104598, after it tail-merges `ret` in
`@test_inline_constraint_S_label`, the verifier would start complaining
`invalid operand for inline asm constraint 'S'`.

Essentially, taking address of a block is mismodelled in IR.
It should probably be an explicit instruction, a first one in block,
that isn't identical to any other instruction of the same type,
so that it can't be hoisted.
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/CodeGen/AArch64/inlineasm-S-constraint.ll
llvm/test/Transforms/SimplifyCFG/hoist-from-addresstaken-block.ll [new file with mode: 0644]