[llvm] [AMDGPU] Guard RewriteMFMAFormStage recolor against unsafe def/use (PR #217396)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 10:35:29 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: xgxanq
<details>
<summary>Changes</summary>
RewriteMFMAFormStage recolors an MFMA rewrite candidate's dst/src2 vreg to AGPR, but previously only checked its uses. If the vreg is also redefined by a non-MFMA VALU or feeds a VGPR-only use, the blind recolor creates an illegal AGPR access and the machine verifier aborts.
Add isRecolorSafe(), which checks both the vreg's defs and their reaching uses before recoloring. When the vreg is not safe to recolor, keep it in VGPR and bridge it to AGPR with a copy for the MFMA operand instead.
---
Patch is 62.82 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/217396.diff
6 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp (+124-86)
- (modified) llvm/lib/Target/AMDGPU/GCNSchedStrategy.h (+6-9)
- (modified) llvm/test/CodeGen/AMDGPU/mfma-no-multiple-copies.mir (+5-4)
- (added) llvm/test/CodeGen/AMDGPU/rewrite-mfma-form-fix-recolor.mir (+87)
- (modified) llvm/test/CodeGen/AMDGPU/rewrite-mfma-single-exit-copy.ll (+110-109)
- (modified) llvm/test/CodeGen/AMDGPU/sched_mfma_rewrite_copies.mir (+61-44)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
index 5816559fcc899..9dccfc3b6275a 100644
--- a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
@@ -2316,40 +2316,69 @@ void GCNSchedStage::modifyRegionSchedule(unsigned RegionIdx,
DAG.Regions[RegionIdx].first = MIOrder.front();
}
-/// Returns true if reaching def \p RD will be in AGPR form after the rewrite
-/// and so needs no bridge copy: a candidate MFMA in \p RewriteSet, an
-/// AV_MOV_*_IMM_PSEUDO, or a copy from a candidate src2 reg in \p CandSrc2Regs.
-/// A non-candidate MFMA stays in VGPR form and still needs a bridge.
-static bool isReachingDefAGPRForm(
- MachineInstr *RD, const SmallPtrSetImpl<MachineInstr *> &RewriteSet,
- const DenseSet<Register> &CandSrc2Regs, const SIInstrInfo &TII) {
- if (TII.isMAI(*RD))
- return RewriteSet.contains(RD);
- if (RD->getOpcode() == AMDGPU::AV_MOV_B32_IMM_PSEUDO ||
- RD->getOpcode() == AMDGPU::AV_MOV_B64_IMM_PSEUDO)
+static bool
+isRewriteCandidateMAI(const MachineInstr *MI, const SIInstrInfo *TII,
+ const SmallPtrSetImpl<MachineInstr *> &RewriteCandsSet) {
+ return TII->isMAI(*MI) && RewriteCandsSet.contains(MI);
+}
+
+static bool canWriteAGPR(const MachineInstr *MI, const SIInstrInfo *TII,
+ const SIRegisterInfo *SRI) {
+ // A writer can write its result into an AGPR lane iff its def operand's
+ // register-class constraint admits AGPRs (AV/agnostic classes do, plain VGPR
+ // classes don't). COPY is a generic opcode with no operand constraint, so
+ // special-case it.
+ if (MI->isCopy())
return true;
- if (RD->isCopy() && CandSrc2Regs.contains(RD->getOperand(1).getReg()))
- return true;
- return false;
+ const MCInstrDesc &Desc = MI->getDesc();
+ if (Desc.getNumDefs() == 0)
+ return false;
+ const TargetRegisterClass *DefRC = TII->getRegClass(Desc, 0);
+ return DefRC && SRI->hasAGPRs(DefRC);
}
-bool RewriteMFMAFormStage::hasUseRequiringVGPR(
- ArrayRef<SlotIndex> Src2ReachingDefs,
- const SmallPtrSetImpl<MachineInstr *> &RewriteSet) {
- for (SlotIndex RDIdx : Src2ReachingDefs) {
- const MachineInstr *RD = DAG.LIS->getInstructionFromIndex(RDIdx);
- SmallVector<MachineOperand *, 8> ReachingUses;
- findReachingUses(RD, DAG.LIS, ReachingUses);
- for (const MachineOperand *UseMO : ReachingUses) {
- const MachineInstr *UseMI = UseMO->getParent();
- if (UseMI->isCopy())
- continue;
- if (TII->isMAI(*UseMI) && RewriteSet.contains(UseMI))
+static bool useAcceptsAGPR(const MachineOperand *Use, const SIInstrInfo *TII,
+ const SIRegisterInfo *SRI) {
+ const MachineInstr *UseMI = Use->getParent();
+ // COPY is a generic opcode with no operand constraint; it can read an AGPR.
+ if (UseMI->isCopy())
+ return true;
+ // The use's static register-class constraint must admit AGPRs.
+ const TargetRegisterClass *UseRC =
+ UseMI->getRegClassConstraint(Use->getOperandNo(), TII, SRI);
+ return UseRC && SRI->hasAGPRs(UseRC);
+}
+
+bool RewriteMFMAFormStage::isRecolorSafe(
+ Register Reg, ArrayRef<MachineOperand *> DstReachingUses,
+ const SmallPtrSetImpl<MachineInstr *> &RewriteCandsSet, bool IsDst) {
+ for (MachineOperand &DefMO : DAG.MRI.def_operands(Reg)) {
+ MachineInstr *DefMI = DefMO.getParent();
+ // A candidate MFMA def is rewritten to AGPR form (it produces the AGPR
+ // result directly), so it does not constrain the recolor.
+ if (isRewriteCandidateMAI(DefMI, TII, RewriteCandsSet))
+ continue;
+ bool CanWriteAGPR = canWriteAGPR(DefMI, TII, SRI);
+ if (!CanWriteAGPR)
+ return false;
+ SmallVector<MachineOperand *, 8> DefReachingUses;
+ findReachingUses(DefMI, DAG.LIS, DefReachingUses);
+ for (MachineOperand *UseMO : DefReachingUses) {
+ // Exempt uses that do not constrain the recolor: for a dst, its own
+ // reaching uses (bridged to VGPR by case2); for a src2, uses that are
+ // candidate MFMAs (they read the AGPR result directly after rewrite).
+ if (IsDst) {
+ if (is_contained(DstReachingUses, UseMO))
+ continue;
+ } else if (isRewriteCandidateMAI(UseMO->getParent(), TII,
+ RewriteCandsSet)) {
continue;
- return true;
+ }
+ if (!useAcceptsAGPR(UseMO, TII, SRI))
+ return false;
}
}
- return false;
+ return true;
}
void RewriteMFMAFormStage::resetRewriteCandsToVGPR(
@@ -2380,12 +2409,6 @@ bool RewriteMFMAFormStage::isRewriteCandidate(MachineInstr *MI) const {
return false;
if (AMDGPU::getAGPRFormOp(MI->getOpcode()) == -1)
return false;
- // Reject candidates whose users force an unavoidable bridge copy.
- Register DstReg = MI->getOperand(0).getReg();
- for (const MachineOperand &Use : DAG.MRI.use_nodbg_operands(DstReg)) {
- if (!TII->isMAI(*Use.getParent()) && !Use.getParent()->isCopy())
- return false;
- }
return true;
}
@@ -2398,15 +2421,11 @@ bool RewriteMFMAFormStage::initHeuristics(
// Collect the candidate group, its members share AGPR-form operands
// post-rewrite, so reaching defs feeding any member don't need bridge copy.
SmallPtrSet<MachineInstr *, 16> RewriteSet;
- DenseSet<Register> CandSrc2Regs;
for (MachineBasicBlock &MBB : MF) {
for (MachineInstr &MI : MBB) {
if (!isRewriteCandidate(&MI))
continue;
RewriteSet.insert(&MI);
- MachineOperand *Src2 = TII->getNamedOperand(MI, AMDGPU::OpName::src2);
- if (Src2 && Src2->isReg())
- CandSrc2Regs.insert(Src2->getReg());
}
}
@@ -2427,17 +2446,13 @@ bool RewriteMFMAFormStage::initHeuristics(
SmallVector<SlotIndex, 8> Src2ReachingDefs;
findReachingDefs(*Src2, DAG.LIS, Src2ReachingDefs);
- // If src2 has a use that must remain VGPR, it cannot be reclassified to
- // AGPR.
- bool Src2NeedsVGPR = hasUseRequiringVGPR(Src2ReachingDefs, RewriteSet);
- Src2NeedsVGPRCache[&MI] = Src2NeedsVGPR;
-
- for (SlotIndex RDIdx : Src2ReachingDefs) {
- MachineInstr *RD = DAG.LIS->getInstructionFromIndex(RDIdx);
- if (!Src2NeedsVGPR &&
- isReachingDefAGPRForm(RD, RewriteSet, CandSrc2Regs, *TII))
- continue;
- CopyForDef.insert(RD);
+ bool Src2RecolorSafe =
+ isRecolorSafe(Src2->getReg(), {}, RewriteSet, /*IsDst=*/false);
+ if (!Src2RecolorSafe) {
+ for (SlotIndex RDIdx : Src2ReachingDefs) {
+ MachineInstr *RD = DAG.LIS->getInstructionFromIndex(RDIdx);
+ CopyForDef.insert(RD);
+ }
}
}
@@ -2445,33 +2460,39 @@ bool RewriteMFMAFormStage::initHeuristics(
SmallVector<MachineOperand *, 8> DstReachingUses;
findReachingUses(&MI, DAG.LIS, DstReachingUses);
+ bool DstRecolorSafe =
+ isRecolorSafe(Dst.getReg(), DstReachingUses, RewriteSet,
+ /*IsDst=*/true);
for (MachineOperand *RUOp : DstReachingUses) {
MachineInstr *UserMI = RUOp->getParent();
+ bool NeedsAGPRToVGPRCopy = true;
// Group members read the AGPR result directly.
if (TII->isMAI(*UserMI) && RewriteSet.contains(UserMI))
- continue;
+ NeedsAGPRToVGPRCopy = false;
// For any user of the result of the MFMA which is not an MFMA, we
- // insert a copy. For a given register, we will only insert one copy
- // per user block.
- CopyForUse[UserMI->getParent()].insert(RUOp->getReg());
-
- if (TII->isMAI(*UserMI))
+ // record a copy location. For a given register, we only record one
+ // copy per user block.
+ if (NeedsAGPRToVGPRCopy)
+ CopyForUse[UserMI->getParent()].insert(RUOp->getReg());
+
+ // If the dst can be wholly recolored to AGPR, its reaching defs are
+ // reclassified along with it, so no per-def bridge copy is needed.
+ if (DstRecolorSafe)
continue;
-
SmallVector<SlotIndex, 8> DstUsesReachingDefs;
findReachingDefs(*RUOp, DAG.LIS, DstUsesReachingDefs);
for (SlotIndex RDIndex : DstUsesReachingDefs) {
MachineInstr *RD = DAG.LIS->getInstructionFromIndex(RDIndex);
- if (TII->isMAI(*RD))
+ if (TII->isMAI(*RD) && RewriteSet.contains(RD))
continue;
- // For any definition of the user of the MFMA which is not an MFMA,
- // we insert a copy. We do this to transform all the reaching defs
- // of this use to AGPR. By doing this, we can insert a copy from
- // AGPR to VGPR at the user rather than after the MFMA.
+ // Dst cannot be recolored: for any non-MFMA reaching def of this
+ // use, record a copy location. This transforms all the reaching
+ // defs of this use to AGPR so the AGPR-to-VGPR copy lands at the
+ // user rather than after the MFMA.
CopyForDef.insert(RD);
}
}
@@ -2693,17 +2714,21 @@ bool RewriteMFMAFormStage::rewrite(
findReachingDefs(*Src2, DAG.LIS, Src2ReachingDefs);
SmallSetVector<MachineInstr *, 8> Src2DefsReplace;
- // If src2 has a use that must remain VGPR, it cannot be reclassified to
- // AGPR.
- bool Src2NeedsVGPR = Src2NeedsVGPRCache.lookup(MI);
-
- for (SlotIndex RDIndex : Src2ReachingDefs) {
- MachineInstr *RD = DAG.LIS->getInstructionFromIndex(RDIndex);
- if (!Src2NeedsVGPR &&
- isReachingDefAGPRForm(RD, RewriteCandsSet, RewriteSrc2Regs, *TII))
- continue;
-
- Src2DefsReplace.insert(RD);
+ // An already-redefined src2 reuses its mapped reg below, so treat it as
+ // unsafe to recolor and collect the reaching defs that need a bridge.
+ bool Src2AlreadyRedef = RedefMap.contains(Src2Reg);
+ bool Src2RecolorSafe =
+ !Src2AlreadyRedef &&
+ isRecolorSafe(Src2Reg, {}, RewriteCandsSet, /*IsDst=*/false);
+ // src2 cannot be recolored to AGPR: collect its non-candidate reaching
+ // defs to bridge below (candidate MFMAs already produce AGPR directly).
+ if (!Src2RecolorSafe) {
+ for (SlotIndex RDIndex : Src2ReachingDefs) {
+ MachineInstr *RD = DAG.LIS->getInstructionFromIndex(RDIndex);
+ if (isRewriteCandidateMAI(RD, TII, RewriteCandsSet))
+ continue;
+ Src2DefsReplace.insert(RD);
+ }
}
if (!Src2DefsReplace.empty()) {
@@ -2768,34 +2793,47 @@ bool RewriteMFMAFormStage::rewrite(
findReachingUses(MI, DAG.LIS, DstReachingUses);
+ // An already-redefined dst reuses its mapped reg, so treat it as unsafe to
+ // recolor and bridge its reaching defs instead.
+ bool DstAlreadyRedef = RedefMap.contains(DstReg);
+ bool DstRecolorSafe =
+ !DstAlreadyRedef &&
+ isRecolorSafe(DstReg, DstReachingUses, RewriteCandsSet, /*IsDst=*/true);
for (MachineOperand *RUOp : DstReachingUses) {
MachineInstr *UserMI = RUOp->getParent();
- // Group members read the AGPR result directly.
- if (TII->isMAI(*UserMI) && RewriteCandsSet.contains(UserMI))
- continue;
-
- // If there is a non mai reaching use, then we need a copy.
- if (find(DstReachingUseCopies, RUOp) == DstReachingUseCopies.end())
+ // A group-member MFMA reads the AGPR result directly; any other user can
+ // only avoid a bridge if it accepts an AGPR operand.
+ bool CanReadAGPR = TII->isMAI(*UserMI) ? RewriteCandsSet.contains(UserMI)
+ : useAcceptsAGPR(RUOp, TII, SRI);
+ if (!CanReadAGPR &&
+ find(DstReachingUseCopies, RUOp) == DstReachingUseCopies.end())
DstReachingUseCopies.push_back(RUOp);
-
- // Non-rewritten MAI: its defs aren't being reclassified.
- if (TII->isMAI(*UserMI))
+ // If the dst is wholly recolored to AGPR, its reaching defs are
+ // reclassified along with it, so none of them need a bridge copy.
+ if (DstRecolorSafe)
continue;
-
SmallVector<SlotIndex, 8> DstUsesReachingDefs;
findReachingDefs(*RUOp, DAG.LIS, DstUsesReachingDefs);
for (SlotIndex RDIndex : DstUsesReachingDefs) {
MachineInstr *RD = DAG.LIS->getInstructionFromIndex(RDIndex);
- if (TII->isMAI(*RD))
+ if (isRewriteCandidateMAI(RD, TII, RewriteCandsSet))
continue;
-
- // If there is a non mai reaching def of this reaching use, then we will
- // need a copy.
+ // A non-candidate reaching def must be bridged to VGPR; record it once
+ // (dedup against DstUseDefsReplace).
if (find(DstUseDefsReplace, RD) == DstUseDefsReplace.end())
DstUseDefsReplace.push_back(RD);
}
}
+ // The dst has no reaching uses and cannot be recolored: create a fresh
+ // reg to carry the AGPR-form value and record the mapping, leaving the
+ // original dst reg in VGPR form.
+ if (DstReachingUses.empty() && !DstRecolorSafe) {
+ const TargetRegisterClass *DstRC = DAG.MRI.getRegClass(DstReg);
+ const TargetRegisterClass *VGPRRC = SRI->getEquivalentVGPRClass(DstRC);
+ MappedReg = DAG.MRI.createVirtualRegister(VGPRRC);
+ RedefMap[DstReg] = MappedReg;
+ }
if (!DstUseDefsReplace.empty()) {
auto RI = RedefMap.find(DstReg);
diff --git a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.h b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.h
index 2059f4e6479ff..f922b694dd6c2 100644
--- a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.h
+++ b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.h
@@ -443,10 +443,6 @@ class RewriteMFMAFormStage : public GCNSchedStage {
const SIInstrInfo *TII;
const SIRegisterInfo *SRI;
- /// Per-candidate cache of the src2 "needs VGPR" decision, computed once
- /// and reused on-demand.
- DenseMap<const MachineInstr *, bool> Src2NeedsVGPRCache;
-
/// Do a speculative rewrite and collect copy locations. The speculative
/// rewrite allows us to calculate the RP of the code after the rewrite, and
/// the copy locations allow us to calculate the total cost of copies required
@@ -486,11 +482,12 @@ class RewriteMFMAFormStage : public GCNSchedStage {
void findReachingUses(const MachineInstr *DefMI, LiveIntervals *LIS,
SmallVectorImpl<MachineOperand *> &ReachingUses);
- /// Returns true if the src2 register with reaching defs \p Src2ReachingDefs
- /// has a use other than a group MFMA (in \p RewriteSet) or a copy, which
- /// would keep it in VGPR form rather than let it be reclassified to AGPR.
- bool hasUseRequiringVGPR(ArrayRef<SlotIndex> Src2ReachingDefs,
- const SmallPtrSetImpl<MachineInstr *> &RewriteSet);
+ /// Returns true if \p Reg (a rewrite candidate's dst or src2, selected by
+ /// \p IsDst) can be wholly reclassified to AGPR without creating an illegal
+ /// VALU AGPR access.
+ bool isRecolorSafe(Register Reg, ArrayRef<MachineOperand *> DstReachingUses,
+ const SmallPtrSetImpl<MachineInstr *> &RewriteCandsSet,
+ bool IsDst);
public:
bool initGCNSchedStage() override;
diff --git a/llvm/test/CodeGen/AMDGPU/mfma-no-multiple-copies.mir b/llvm/test/CodeGen/AMDGPU/mfma-no-multiple-copies.mir
index c7ae0a2c2ef93..de9c11753db37 100644
--- a/llvm/test/CodeGen/AMDGPU/mfma-no-multiple-copies.mir
+++ b/llvm/test/CodeGen/AMDGPU/mfma-no-multiple-copies.mir
@@ -42,10 +42,11 @@ body: |
; CHECK-NEXT: bb.2:
; CHECK-NEXT: KILL %p0, %p1, %p2, %p3, %p4, %p5, %p6, %p7
; CHECK-NEXT: %m4:areg_128_align2 = V_MFMA_F32_16X16X32_F16_e64 undef %s0:vreg_128_align2, undef %s1:vreg_128_align2, %m2, 0, 0, 0, implicit $mode, implicit $exec
- ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vreg_128_align2 = COPY %m4
- ; CHECK-NEXT: %out1:vreg_128_align2 = V_MFMA_F32_16X16X32_F16_vgprcd_e64 undef %s0:vreg_128_align2, undef %s1:vreg_128_align2, [[COPY1]], 0, 0, 0, implicit $mode, implicit $exec
- ; CHECK-NEXT: %out2:vreg_128_align2 = V_MFMA_F32_16X16X32_F16_vgprcd_e64 undef %s1:vreg_128_align2, undef %s0:vreg_128_align2, [[COPY1]], 0, 0, 0, implicit $mode, implicit $exec
- ; CHECK-NEXT: S_ENDPGM 0, implicit %out1, implicit %out2
+ ; CHECK-NEXT: %out1:areg_128_align2 = V_MFMA_F32_16X16X32_F16_e64 undef %s0:vreg_128_align2, undef %s1:vreg_128_align2, %m4, 0, 0, 0, implicit $mode, implicit $exec
+ ; CHECK-NEXT: %out2:areg_128_align2 = V_MFMA_F32_16X16X32_F16_e64 undef %s1:vreg_128_align2, undef %s0:vreg_128_align2, %m4, 0, 0, 0, implicit $mode, implicit $exec
+ ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vreg_128_align2 = COPY %out1
+ ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vreg_128_align2 = COPY %out2
+ ; CHECK-NEXT: S_ENDPGM 0, implicit [[COPY1]], implicit [[COPY2]]
bb.0:
successors: %bb.1(0x80000000)
%p0:vreg_1024 = IMPLICIT_DEF
diff --git a/llvm/test/CodeGen/AMDGPU/rewrite-mfma-form-fix-recolor.mir b/llvm/test/CodeGen/AMDGPU/rewrite-mfma-form-fix-recolor.mir
new file mode 100644
index 0000000000000..cc53c87fd6299
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/rewrite-mfma-form-fix-recolor.mir
@@ -0,0 +1,87 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 6
+# RUN: llc -mtriple=amdgpu9.50-amd-amdhsa -run-pass=machine-scheduler \
+# RUN: -amdgpu-disable-rewrite-mfma-form-sched-stage=false \
+# RUN: -verify-machineinstrs -o - %s | FileCheck %s
+
+# Correctness test for the RewriteMFMAFormStage def-side recolor guard. The loop
+# MFMA's src2 %acc is partially redefined in the epilogue (%acc.sub0) and read by
+# a VGPR-only DS_READ_B32. isRecolorSafe scans the reaching uses of %acc's defs,
+# sees that read, and keeps %acc in VGPR -- bridging it to AGPR with a copy for
+# src2 instead of recoloring the whole vreg (which would abort with
+# "AReg_64_Align2.sub0 cannot be used for VGPR_32 operands").
+
+--- |
+ define amdgpu_kernel void @mfma_fix_recolor() #0 {
+ ret void
+ }
+
+ attributes #0 = { "amdgpu-flat-work-group-size"="1,256" }
+...
+---
+name: mfma_fix_recolor
+tracksRegLiveness: true
+body: |
+ ; CHECK-LABEL: name: mfma_fix_recolor
+ ; CHECK: bb.0:
+ ; CHECK-NEXT: successors: %bb.1(0x80000000)
+ ; CHECK-NEXT: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $sgpr0
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: %s0:vreg_64_align2 = COPY $vgpr0_vgpr1
+ ; CHECK-NEXT: %s1:vreg_64_align2 = COPY $vgpr2_vgpr3
+ ; CHECK-NEXT: %cnt:sgpr_32 = COPY $sgpr0
+ ; CHECK-NEXT: %acc:vreg_64_align2 = AV_MOV_B64_IMM_PSEUDO 0, implicit $exec
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:areg_64_align2 = COPY %acc
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.1:
+ ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: dead %mdst:areg_64_align2 = V_MFMA_F64_4X4X4F64_e64 %s0, %s1, [[COPY]], 0, 0, 0, implicit $mode, implicit $exec
+ ; CHECK-NEXT: %cnt:sgpr_32 = S_SUB_I32 %cnt, 1, implicit-def $scc
+ ; CHECK-NEXT: S_CBRANCH_SCC1 %bb.1, implicit $scc
+ ; CHECK-NEXT: S_BRANCH %bb.2
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.2:
+ ; CHECK-NEXT: %acc.sub0:vreg_64_align2 = AV_MOV_B32_IMM_PSEUDO 7, implicit $exec
+ ; CHECK-NEXT: dead %conn:vreg_64_align2 = COPY %acc
+ ; CHECK-NEXT: %ld:vgpr_32 = DS_READ_B32_gfx9 %acc.sub0, 0, 0, implicit $exec :: (load (s32), addrspace 3)
+ ; CHECK-NEXT: [[DEF:%[0-9]+]]:vreg_1024 = IMPLICIT_DEF
+ ; CHECK-NEXT: [[DEF1:%[0-9]+]]:vreg_1024 = IMPLICIT_DEF
+ ; CHECK-NEXT: [[DEF2:%[0-9]+]]:vreg_1024 = IMPLICIT_DEF
+ ; CHECK-NEXT: [[DEF3:%[0-9]+]]:vreg_1024 = IMPLICIT_DEF
+ ; CHECK-NEXT: [[DEF4:%[0-9]+]]:vreg_1024 = IMPLICIT_DEF
+ ; CHECK-NEXT: [[DEF5:%[0-9]+]]:vreg_1024 = IMPLICIT_DEF
+ ; CHECK-NEXT: [[DEF6:%[0-9]+]]:vreg_1024 = IMPLICIT_DEF
+ ; CHECK-NEXT: [[DEF7:%[0-9]+]]:vreg_1024 = IMPLICIT_DEF
+ ; CHECK-NEXT: [[DEF8:%[0-9]+]]:vreg_1024 = IMPLICIT_DEF
+ ; CHECK-NEXT: S_ENDPGM 0, implicit %ld, implicit [[DEF]], implicit [[DEF1]], implicit [[DEF2]], implicit [[DEF3]], implicit [[DEF4]], implicit [[DEF5]], implicit [[DEF6]], implicit [[DEF7]], implicit [[DEF8]]
+ bb.0:
+ successors: %bb.1
+ liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $sgpr0
+
+ %s0:vreg_64_align2 = COPY $vgpr0_vgpr1
+ %s1:vreg_64_align2 = COPY $vgpr2_vgpr3
+ %cnt:sgpr_32 = COPY $sgpr0
+ %p0:vreg_1024 = IMPLICIT_DEF
+ %p1:vreg_1024 = IMPLICIT_...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/217396
More information about the llvm-commits
mailing list