Reland "[InitUndef] handleSubReg should skip artificial subregs. (#116248)"

This patch can now reland after 318c69de52 relanded #114827.

This reverts commit 1683f84d28.
This commit is contained in:
Sander de Smalen
2024-11-27 09:19:40 +00:00
parent 04a2d50efd
commit 61653f8e39
2 changed files with 10 additions and 1 deletions

View File

@@ -164,6 +164,14 @@ bool InitUndef::handleSubReg(MachineFunction &MF, MachineInstr &MI,
TRI->getCoveringSubRegIndexes(*MRI, TargetRegClass, NeedDef,
SubRegIndexNeedInsert);
// It's not possible to create the INIT_UNDEF when there is no register
// class associated for the subreg. This may happen for artificial subregs
// that are not directly addressable.
if (any_of(SubRegIndexNeedInsert, [&](unsigned Ind) -> bool {
return !TRI->getSubRegisterClass(TargetRegClass, Ind);
}))
continue;
Register LatestReg = Reg;
for (auto ind : SubRegIndexNeedInsert) {
Changed = true;

View File

@@ -1,5 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
# RUN: llc -mtriple=aarch64-- -run-pass=init-undef -o - %s | FileCheck %s
# RUN: llc -mtriple=aarch64-- -aarch64-enable-subreg-liveness-tracking=false -run-pass=init-undef -o - %s | FileCheck %s
# RUN: llc -mtriple=aarch64-- -aarch64-enable-subreg-liveness-tracking=true -run-pass=init-undef -o - %s | FileCheck %s
---
name: test_stxp_undef