The insertion of tbb/tbh instructions should be placed where the previous jump table instruction was, not at the end of the block. It is possible that new water was created after a basic block that ends in a jump table, due to not having a sufficient area within range. In this case, the new water is created at the end of the block and an unconditional branch instruction is added to the end of the basic block. A subsequent Thumb2 optimization of the jump table places a tbb/tbh at the end of the block and erases the existing jump table branch. But this results in the unconditional branch being hit before the jump table ever gets hit.
This patch places the tbb/tbh at the same location as the jump table branch.
There's an @llvm.arm.space intrinsic now. It acts as an "instruction" of the precise size you specify. It's probably clearer and more efficient than putting in just the right number of real instructions.