getARMVPTBlockMask was an outdated function that only handled basic block masks: T, TT, TTT and TTTT.
This worked fine before the MVE VPT Block Insertion Pass improvements as it was the only kind of masks that it could generate, but now it can generate more complex masks that uses E predicates, so it's dangerous to use that function to calculate VPT/VPST block masks.
I replaced it with 2 different functions:
- expandPredBlockMask, in ARMBaseInfo. This adds an "E" or "T" at the end of an existing PredBlockMask.
- recomputeVPTBlockMask, in Thumb2InstrInfo. This takes an iterator to a VPT/VPST instruction and recomputes its block mask by looking at the predicated instructions that follows it. This should be used to recompute a block mask after removing/adding a predicated instruction to the block.
The expandPredBlockMask function is pretty much imported from the MVE VPT Blocks pass.
I also had to change the ARMLowOverheadLoops and MVEVPTBlocks passes as well so they could use these new functions.
I think it would be cleaner just to pass a MachineInstr, which you can then derive these iterators.