[PATCH] D128553: [LiveIntervals] Fix incorrect range (re)construction from subranges.
Daniil Fukalov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 8 06:07:38 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6858a17f66f6: [LiveIntervals] Fix incorrect range (re)construction from subranges. (authored by dfukalov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128553/new/
https://reviews.llvm.org/D128553
Files:
llvm/lib/CodeGen/LiveIntervals.cpp
llvm/unittests/MI/LiveIntervalTest.cpp
Index: llvm/unittests/MI/LiveIntervalTest.cpp
===================================================================
--- llvm/unittests/MI/LiveIntervalTest.cpp
+++ llvm/unittests/MI/LiveIntervalTest.cpp
@@ -532,6 +532,19 @@
});
}
+TEST(LiveIntervalTest, TestMoveSubRegsOfOneReg) {
+ liveIntervalTest(R"MIR(
+ INLINEASM &"", 0, 1835018, def undef %4.sub0:vreg_64, 1835018, def undef %4.sub1:vreg_64
+ %1:vreg_64 = COPY %4
+ undef %2.sub0:vreg_64 = V_MOV_B32_e32 0, implicit $exec
+ %2.sub1:vreg_64 = COPY %2.sub0
+ %3:vreg_64 = COPY %2
+)MIR", [](MachineFunction &MF, LiveIntervals &LIS) {
+ testHandleMove(MF, LIS, 1, 4);
+ testHandleMove(MF, LIS, 0, 3);
+ });
+}
+
TEST(LiveIntervalTest, BundleUse) {
liveIntervalTest(R"MIR(
%0 = IMPLICIT_DEF
Index: llvm/lib/CodeGen/LiveIntervals.cpp
===================================================================
--- llvm/lib/CodeGen/LiveIntervals.cpp
+++ llvm/lib/CodeGen/LiveIntervals.cpp
@@ -1049,12 +1049,17 @@
// we may end up with a main range not covering all subranges.
// This is extremely rare case, so let's check and reconstruct the
// main range.
- for (LiveInterval::SubRange &S : LI.subranges()) {
- if (LI.covers(S))
- continue;
- LI.clear();
- LIS.constructMainRangeFromSubranges(LI);
- break;
+ if (LI.hasSubRanges()) {
+ unsigned SubReg = MO.getSubReg();
+ LaneBitmask LaneMask = SubReg ? TRI.getSubRegIndexLaneMask(SubReg)
+ : MRI.getMaxLaneMaskForVReg(Reg);
+ for (LiveInterval::SubRange &S : LI.subranges()) {
+ if ((S.LaneMask & LaneMask).none() || LI.covers(S))
+ continue;
+ LI.clear();
+ LIS.constructMainRangeFromSubranges(LI);
+ break;
+ }
}
continue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128553.443228.patch
Type: text/x-patch
Size: 1896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220708/81abd28c/attachment.bin>
More information about the llvm-commits
mailing list