[ARM] Fix Arm block placement creating branches after jump tables.
authorDavid Green <david.green@arm.com>
Sat, 25 Sep 2021 10:32:25 +0000 (11:32 +0100)
committerDavid Green <david.green@arm.com>
Sat, 25 Sep 2021 10:32:25 +0000 (11:32 +0100)
commit883758ed480012a875146bc206cb8bcdd384405b
tree42270a74097d00f79360c0c7963d8c57e8e4ca22
parentb02938439dab1f282d28a4a94419de505f0f9c6e
[ARM] Fix Arm block placement creating branches after jump tables.

Given:
 - A jump table
 - Which jumps to the next block
 - The next block ends in a WLS
 - Where the WLS conditionally jumps to block earlier in the program.

The Arm block placement pass would attempt to move the block containing
the WLS earlier, as the WLS instruction can only branch forward. In
doing so it would add a branch from the jumptable block to the WLS
block, thinking it previously fell-through.

This in itself would be fine, if a little inefficient, but the constant
island pass expects all instructions after a jump-table branch to have
been removed by analyzeBranch. So it gets confused and can assign the
same labels to multiple jump table blocks.

I've changed the condition to the same as used in analyzeBranch.
llvm/lib/Target/ARM/ARMBlockPlacement.cpp
llvm/test/CodeGen/Thumb2/mve-wls-block-placement.mir