IndirectBrExpandPass could create invalid IR when the destination contains PHI instruction. This causes error PHINode should have one entry for each predecessor of its parent basic block! during verification.
Should we consider this as a bug for IndirectBrExpandPass, or should we not allow PHI in indirectbr destination?
Description
IndirectBrExpandPass
could create invalid IR when the destination contains PHI instruction. This causes errorPHINode should have one entry for each predecessor of its parent basic block!
during verification.Should we consider this as a bug for
IndirectBrExpandPass
, or should we not allow PHI inindirectbr
destination?Minimal Reproduction
https://godbolt.org/z/1s5arzWPG
In this example, a new BB
switch_bb
is created to replaceindirectbr
. However, the PHI instruction inbb1
is left unchanged and becomes invalid.Code
Stack Trace