[llvm] f0e5f73 - [MachineScheduler] Account for lane masks in basic block liveins
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 02:04:01 PDT 2023
Author: Jay Foad
Date: 2023-08-15T09:52:43+01:00
New Revision: f0e5f73fdcb2be36bea31bbc67457b82b2e3ed86
URL: https://github.com/llvm/llvm-project/commit/f0e5f73fdcb2be36bea31bbc67457b82b2e3ed86
DIFF: https://github.com/llvm/llvm-project/commit/f0e5f73fdcb2be36bea31bbc67457b82b2e3ed86.diff
LOG: [MachineScheduler] Account for lane masks in basic block liveins
Differential Revision: https://reviews.llvm.org/D157633
Added:
Modified:
llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
llvm/test/CodeGen/AMDGPU/loop-live-out-copy-undef-subrange.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
index d22de53d821fd2..0190fa345eb363 100644
--- a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
+++ b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
@@ -223,9 +223,9 @@ void ScheduleDAGInstrs::addSchedBarrierDeps() {
// uses all the registers that are livein to the successor blocks.
for (const MachineBasicBlock *Succ : BB->successors()) {
for (const auto &LI : Succ->liveins()) {
- // TODO: Use LI.LaneMask to refine this.
- for (MCRegUnit Unit : TRI->regunits(LI.PhysReg)) {
- if (!Uses.contains(Unit))
+ for (MCRegUnitMaskIterator U(LI.PhysReg, TRI); U.isValid(); ++U) {
+ auto [Unit, Mask] = *U;
+ if ((Mask & LI.LaneMask).any() && !Uses.contains(Unit))
Uses.insert(PhysRegSUOper(&ExitSU, -1, Unit));
}
}
diff --git a/llvm/test/CodeGen/AMDGPU/loop-live-out-copy-undef-subrange.ll b/llvm/test/CodeGen/AMDGPU/loop-live-out-copy-undef-subrange.ll
index 6c858efaf37d21..7738ec689dc7eb 100644
--- a/llvm/test/CodeGen/AMDGPU/loop-live-out-copy-undef-subrange.ll
+++ b/llvm/test/CodeGen/AMDGPU/loop-live-out-copy-undef-subrange.ll
@@ -10,9 +10,9 @@ define <3 x float> @liveout_undef_subrange(<3 x float> %arg) {
; CHECK: ; %bb.0: ; %bb
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; CHECK-NEXT: v_add_f32_e32 v3, v2, v2
-; CHECK-NEXT: v_add_f32_e32 v0, v0, v0
; CHECK-NEXT: s_mov_b64 s[4:5], 0
; CHECK-NEXT: ; kill: killed $vgpr1
+; CHECK-NEXT: v_add_f32_e32 v0, v0, v0
; CHECK-NEXT: .LBB0_1: ; %bb1
; CHECK-NEXT: ; =>This Inner Loop Header: Depth=1
; CHECK-NEXT: v_cmp_neq_f32_e32 vcc, 0, v2
More information about the llvm-commits
mailing list