[CodeGen] Fix finalizeBundle for a redefinition after a dead def
Since 58f3b0dd8d7b (#155448), finalizeBundle() sets the register units
of a physical register in LocalDefsP only for the first def of the
register in the bundle, and only if that def is not dead. When a
register is defined dead and then defined again, a later read in the
bundle is not marked internal, and the BUNDLE reads the register from
outside the bundle. With -verify-machineinstrs, this gives "Using an
undefined physical register", for example after IT block insertion on
Thumb2.
Set the units for every def that is not dead, as before #155448. This
runs the loop over the units again for each such def, not only for the
first one.
This is a regression in LLVM 22: llc 21.1.8 compiles the IR that the
Thumb2 test is reduced from without the error. I did not see wrong code
from it: only the internal flag of the read and the operands of the
BUNDLE are wrong.
Assisted-by: Claude Code (Claude Opus 5.5)