[PATCH] D115360: [MachineVerifier] Undef subreg operands do not require subranges
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 8 09:43:23 PST 2021
foad created this revision.
foad added reviewers: arsenm, MatzeB, qcolombet, bjope.
Herald added subscribers: kerbowa, hiraditya, tpr, nhaehnle, jvesely.
foad requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
D112556 <https://reviews.llvm.org/D112556> added verification that the live interval for a subreg operand
must have subranges. This patch fixes a corner case, where if all subreg
operands for a particular register are marked as undef then no subranges
are required. This matches how LiveIntervalCalc would build the live
intervals in the first place, since an undef operand is not considered
to read the register.
Before this patch, CodeGen/AMDGPU/no-remat-indirect-mov.mir would fail
with -early-live-intervals:
1. After Live Interval Analysis
...
- Bad machine code: Live interval for subreg operand has no subranges ***
- function: index_vgpr_waterfall_loop
- basic block: %bb.1 (0x6a9a968) [352B;496B)
- instruction: 432B %24:vgpr_32 = V_MOV_B32_e32 undef %18.sub0:vreg_512, implicit $exec, implicit %18:vreg_512, implicit $m0
- operand 1: undef %18.sub0:vreg_512
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115360
Files:
llvm/lib/CodeGen/MachineVerifier.cpp
llvm/test/CodeGen/AMDGPU/no-remat-indirect-mov.mir
Index: llvm/test/CodeGen/AMDGPU/no-remat-indirect-mov.mir
===================================================================
--- llvm/test/CodeGen/AMDGPU/no-remat-indirect-mov.mir
+++ llvm/test/CodeGen/AMDGPU/no-remat-indirect-mov.mir
@@ -1,5 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -start-after=phi-node-elimination -stop-before=greedy -o - %s | FileCheck -check-prefix=GFX9 %s
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -start-after=phi-node-elimination -stop-before=greedy -early-live-intervals -o - %s | FileCheck -check-prefix=GFX9 %s
# Make sure that the V_MOV_B32 isn't rematerialized out of the loop. This was also breaking RenameIndependentSubregisters which missed the use of all subregisters.
Index: llvm/lib/CodeGen/MachineVerifier.cpp
===================================================================
--- llvm/lib/CodeGen/MachineVerifier.cpp
+++ llvm/lib/CodeGen/MachineVerifier.cpp
@@ -2229,8 +2229,8 @@
if (LiveInts && Reg.isVirtual()) {
if (LiveInts->hasInterval(Reg)) {
LI = &LiveInts->getInterval(Reg);
- if (SubRegIdx != 0 && !LI->empty() && !LI->hasSubRanges() &&
- MRI->shouldTrackSubRegLiveness(Reg))
+ if (SubRegIdx != 0 && !MO->isUndef() && !LI->empty() &&
+ !LI->hasSubRanges() && MRI->shouldTrackSubRegLiveness(Reg))
report("Live interval for subreg operand has no subranges", MO, MONum);
} else {
report("Virtual register has no live interval", MO, MONum);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115360.392819.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211208/d6b1488c/attachment.bin>
More information about the llvm-commits
mailing list