[llvm] [AMDGPU] Post-RA Peephole for Two-Address Instructions (PR #207731)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 06:20:41 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Lukas Sommer (sommerlukas)
<details>
<summary>Changes</summary>
Post register allocation peephole optimization to turn two-address instructions followed by copies into their three-address equivalent directly targeting the copy-destination registers. This converts cases missed by the `TwoAddressInstructionPass` earlier in the pipeline.
The transformation turns
```
$vgpr2 = two-address instruction ... $vgpr2 ...
$vgpr0 = move/copy $vgpr2
```
into
```
$vgpr0 = three-address instruction ... $vgpr2 ...
```
to avoid the copies.
Currently, the peephole is narrowly scoped to `V_FMAC` variants for now but could be extended to other instructions that can be converted to three-address instructions and other kinds of copy-like instructions.
This fixes https://github.com/llvm/llvm-project/issues/171891.
---
Patch is 69.57 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/207731.diff
17 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp (+182-4)
- (modified) llvm/test/CodeGen/AMDGPU/hazard-pass-ordering.mir (+3)
- (modified) llvm/test/CodeGen/AMDGPU/insert-handle-flat-vmem-ds.mir (+3)
- (modified) llvm/test/CodeGen/AMDGPU/insert-skip-from-vcc.mir (+49)
- (modified) llvm/test/CodeGen/AMDGPU/insert-skips-gfx10.mir (+7)
- (modified) llvm/test/CodeGen/AMDGPU/insert-skips-gfx12.mir (+20)
- (modified) llvm/test/CodeGen/AMDGPU/insert-skips-gfx1250.mir (+2)
- (modified) llvm/test/CodeGen/AMDGPU/insert-skips-gws.mir (+2)
- (modified) llvm/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir (+1)
- (modified) llvm/test/CodeGen/AMDGPU/llc-pipeline.ll (+4)
- (modified) llvm/test/CodeGen/AMDGPU/remove-not-short-exec-branch-on-unconditional-jump.mir (+1)
- (modified) llvm/test/CodeGen/AMDGPU/remove-short-exec-branches-gpr-idx-mode.mir (+4)
- (modified) llvm/test/CodeGen/AMDGPU/remove-short-exec-branches-special-instructions.mir (+10)
- (modified) llvm/test/CodeGen/AMDGPU/set-gpr-idx-peephole.mir (+140-24)
- (added) llvm/test/CodeGen/AMDGPU/si-pre-emit-peephole-fmac.mir (+63)
- (modified) llvm/test/CodeGen/AMDGPU/si-pre-emit-peephole-preserve-loop-info.mir (+9)
- (modified) llvm/test/CodeGen/AMDGPU/skip-branch-taildup-ret.mir (+2)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp b/llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
index a496c9a4daa71..734ccbad4eb35 100644
--- a/llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
+++ b/llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
@@ -26,6 +26,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachinePostDominators.h"
+#include "llvm/CodeGen/ReachingDefAnalysis.h"
#include "llvm/CodeGen/TargetSchedule.h"
#include "llvm/Support/BranchProbability.h"
using namespace llvm;
@@ -39,6 +40,7 @@ class SIPreEmitPeephole {
const SIInstrInfo *TII = nullptr;
const SIRegisterInfo *TRI = nullptr;
MachineLoopInfo *MLI = nullptr;
+ const ReachingDefInfo *RDI = nullptr;
bool optimizeVccBranch(MachineInstr &MI) const;
void updateMLIBeforeRemovingEdge(MachineBasicBlock *From,
@@ -81,8 +83,35 @@ class SIPreEmitPeephole {
void addOperandAndMods(MachineInstrBuilder &NewMI, unsigned SrcMods,
bool IsHiBits, const MachineOperand &SrcMO);
+ // Hold information about a candidate for delayed post-RA conversion from a
+ // two-address instruction to a three-address instruction. The copy
+ // instructions become redundant after retargeting the converted instruction
+ // to NewDst.
+ struct ThreeAddressCandidate {
+ MachineInstr *TwoAddrMI;
+ Register NewDst;
+ SmallVector<MachineInstr *, 2> CopiesToRemove;
+
+ ThreeAddressCandidate(MachineInstr &TwoAddrMI, Register NewDst,
+ ArrayRef<MachineInstr *> Copies)
+ : TwoAddrMI(&TwoAddrMI), NewDst(NewDst), CopiesToRemove(Copies) {}
+ };
+ // Check if \p MaybeCopy is a simple copy of \p Src. If it is a supported
+ // copy, return the destination register of the copy.
+ std::optional<Register> checkCopy(MachineInstr &TwoAddress,
+ MachineInstr &MaybeCopy, Register Src);
+ // Check whether the two-address instruction should be replaced with a
+ // three-address instruction to avoid copies of the output registers. If the
+ // replacement should take place, returns the destination register for the
+ // replacement and fills \p Copies with the copy instructions to remove after
+ // the replacement.
+ Register
+ shouldReplaceWithThreeAddress(MachineInstr &MI,
+ SmallVectorImpl<MachineInstr *> &Copies);
+
public:
- bool run(MachineFunction &MF, MachineLoopInfo *MLI);
+ bool run(MachineFunction &MF, MachineLoopInfo *MLI,
+ const ReachingDefInfo *RDI);
};
class SIPreEmitPeepholeLegacy : public MachineFunctionPass {
@@ -94,13 +123,16 @@ class SIPreEmitPeepholeLegacy : public MachineFunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addUsedIfAvailable<MachineLoopInfoWrapperPass>();
AU.addPreserved<MachineLoopInfoWrapperPass>();
+ AU.addRequired<ReachingDefInfoWrapperPass>();
MachineFunctionPass::getAnalysisUsage(AU);
}
bool runOnMachineFunction(MachineFunction &MF) override {
auto *MLIWrapper = getAnalysisIfAvailable<MachineLoopInfoWrapperPass>();
MachineLoopInfo *MLI = MLIWrapper ? &MLIWrapper->getLI() : nullptr;
- return SIPreEmitPeephole().run(MF, MLI);
+ const ReachingDefInfo *RDI =
+ &getAnalysis<ReachingDefInfoWrapperPass>().getRDI();
+ return SIPreEmitPeephole().run(MF, MLI, RDI);
}
};
@@ -763,13 +795,105 @@ MachineInstrBuilder SIPreEmitPeephole::createUnpackedMI(MachineInstr &I,
return NewMI;
}
+std::optional<Register> SIPreEmitPeephole::checkCopy(MachineInstr &TwoAddress,
+ MachineInstr &MaybeCopy,
+ Register Src) {
+ if (MaybeCopy.isBundle())
+ return std::nullopt;
+
+ switch (MaybeCopy.getOpcode()) {
+ case AMDGPU::COPY:
+ case AMDGPU::V_MOV_B32_e32:
+ break;
+ default:
+ return std::nullopt;
+ }
+
+ MachineOperand CopySrc = MaybeCopy.getOperand(1);
+ if (!CopySrc.isReg() || CopySrc.getReg() != Src)
+ return std::nullopt;
+
+ MachineOperand Dst = MaybeCopy.getOperand(0);
+ if (!Dst.isReg())
+ return std::nullopt;
+
+ Register Reg = Dst.getReg();
+ // Check that it is safe to define the copy destination register at the
+ // current position of the two-address instruction.
+ SmallPtrSet<MachineInstr *, 1> Ignore{&TwoAddress, &MaybeCopy};
+ if (!RDI->isSafeToDefRegAt(&TwoAddress, Reg, Ignore))
+ return std::nullopt;
+
+ // Check that the two-address instruction and the copy have the same exec
+ // mask.
+ if (!RDI->hasSameReachingDef(&TwoAddress, &MaybeCopy, AMDGPU::EXEC))
+ return std::nullopt;
+
+ return Reg;
+}
+
+Register SIPreEmitPeephole::shouldReplaceWithThreeAddress(
+ MachineInstr &MI, SmallVectorImpl<MachineInstr *> &Copies) {
+ MachineOperand *Dst = TII->getNamedOperand(MI, AMDGPU::OpName::vdst);
+ if (!Dst || !Dst->isReg())
+ return Register();
+
+ SmallVector<Register, 2> DestRegs;
+ Register Sub0 = TRI->getSubReg(Dst->getReg(), AMDGPU::sub0);
+ Register Sub1 = TRI->getSubReg(Dst->getReg(), AMDGPU::sub1);
+ if (Sub0 && Sub1) {
+ DestRegs.push_back(Sub0);
+ DestRegs.push_back(Sub1);
+ } else
+ DestRegs.push_back(Dst->getReg());
+
+ SmallVector<Register, 2> Replacements;
+ for (Register SubReg : DestRegs) {
+ if (!SubReg.isPhysical())
+ return Register();
+ if (RDI->getLocalLiveOutMIDef(MI.getParent(), SubReg) == &MI)
+ return Register();
+
+ SmallPtrSet<MachineInstr *, 1> Uses;
+ RDI->getReachingLocalUses(&MI, SubReg, Uses);
+ if (Uses.size() != 1)
+ return Register();
+
+ MachineInstr &Use = **Uses.begin();
+ std::optional<Register> MaybeRegister = checkCopy(MI, Use, SubReg);
+
+ if (!MaybeRegister)
+ return Register();
+ Replacements.push_back(*MaybeRegister);
+ Copies.push_back(&Use);
+ }
+
+ if (Replacements.size() > 2)
+ return Register();
+
+ if (Replacements.size() == 1)
+ return Replacements.front();
+
+ // Try to identify a matching super-register/tuple for the f64 case and abort
+ // the transformation if there is none.
+ Register Tuple = TRI->getMatchingSuperReg(Replacements.front(), AMDGPU::sub0,
+ TRI->getVGPR64Class());
+ if (!Tuple)
+ return Register();
+
+ if (TRI->getSubReg(Tuple, AMDGPU::sub1) != Replacements[1].asMCReg())
+ return Register();
+ return Tuple;
+}
+
PreservedAnalyses
llvm::SIPreEmitPeepholePass::run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM) {
auto *MLI = MFAM.getCachedResult<MachineLoopAnalysis>(MF);
+ const ReachingDefInfo &RDI = MFAM.getResult<ReachingDefAnalysis>(MF);
SIPreEmitPeephole Impl;
- if (Impl.run(MF, MLI)) {
+ if (Impl.run(MF, MLI, &RDI)) {
auto PA = getMachineFunctionPassPreservedAnalyses();
PA.preserve<MachineLoopAnalysis>();
return PA;
@@ -778,11 +902,13 @@ llvm::SIPreEmitPeepholePass::run(MachineFunction &MF,
return PreservedAnalyses::all();
}
-bool SIPreEmitPeephole::run(MachineFunction &MF, MachineLoopInfo *LoopInfo) {
+bool SIPreEmitPeephole::run(MachineFunction &MF, MachineLoopInfo *LoopInfo,
+ const ReachingDefInfo *ReachingDefInfo) {
const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>();
TII = ST.getInstrInfo();
TRI = &TII->getRegisterInfo();
MLI = LoopInfo;
+ RDI = ReachingDefInfo;
bool Changed = false;
MF.RenumberBlocks();
@@ -803,6 +929,58 @@ bool SIPreEmitPeephole::run(MachineFunction &MF, MachineLoopInfo *LoopInfo) {
}
}
+ // Delayed optimization to replace two-address instructions followed by
+ // copies with a three-address instruction that directly writes to the
+ // copied registers instead. The pattern we seek to optimize is:
+ // $vgpr2_vgpr3 = V_FMAC_F64 ..., $vgpr_2_vgpr3
+ // $vgpr0 = V_MOV_B32 $vgrp2
+ // $vgpr1 = V_MOV_B32 $vgrp3
+ //
+ // This can be optimized to:
+ // $vgpr0_vgpr1 = V_FMA_F64 ..., $vgpr2_vgpr3
+ //
+ // The TwoAddressInstruction pass handles some cases, but bails in more
+ // complex cases.
+ SmallVector<ThreeAddressCandidate> Candidates;
+ // First, collect the candidates. We can't perform the transformation right
+ // away, it would invalidate the iterator.
+ for (auto &MI : make_early_inc_range(MBB.instrs())) {
+ if (MI.isBundle())
+ continue;
+
+ unsigned Opc = MI.getOpcode();
+ if (Opc != AMDGPU::V_FMAC_F64_e64 && Opc != AMDGPU::V_FMAC_F32_e64 &&
+ Opc != AMDGPU::V_FMAC_F64_e32 && Opc != AMDGPU::V_FMAC_F32_e32)
+ continue;
+
+ SmallVector<MachineInstr *, 2> Copies;
+ if (Register Dst = shouldReplaceWithThreeAddress(MI, Copies))
+ Candidates.emplace_back(MI, Dst, Copies);
+ }
+
+ for (ThreeAddressCandidate &Cand : Candidates) {
+ MachineInstr *ThreeAddrsInst =
+ TII->convertToThreeAddress(*Cand.TwoAddrMI, nullptr, nullptr);
+ if (!ThreeAddrsInst)
+ continue;
+ MachineOperand &NewDst = ThreeAddrsInst->getOperand(0);
+ assert(NewDst.isReg());
+
+ const TargetRegisterClass *DstRC =
+ TII->getRegClass(ThreeAddrsInst->getDesc(), NewDst.getOperandNo());
+ if (DstRC && !DstRC->contains(Cand.NewDst.asMCReg())) {
+ ThreeAddrsInst->eraseFromParent();
+ continue;
+ }
+
+ NewDst.setReg(Cand.NewDst);
+ NewDst.setIsRenamable(false);
+ Cand.TwoAddrMI->eraseFromParent();
+ llvm::for_each(Cand.CopiesToRemove,
+ [](MachineInstr *Copy) { Copy->eraseFromParent(); });
+ Changed = true;
+ }
+
if (!ST.hasVGPRIndexMode())
continue;
diff --git a/llvm/test/CodeGen/AMDGPU/hazard-pass-ordering.mir b/llvm/test/CodeGen/AMDGPU/hazard-pass-ordering.mir
index 093a8e02e0ab1..e4a99f04e3537 100644
--- a/llvm/test/CodeGen/AMDGPU/hazard-pass-ordering.mir
+++ b/llvm/test/CodeGen/AMDGPU/hazard-pass-ordering.mir
@@ -10,8 +10,11 @@
# GCN-NEXT: s_nop
# GCN-NEXT: flat_load_dword
name: mai_hazard_pass_ordering_optimize_vcc_branch
+tracksRegLiveness: true
body: |
bb.0:
+ liveins: $agpr0, $vgpr1
+
$vgpr0 = V_MOV_B32_e32 1, implicit $exec
$vgpr2 = V_ACCVGPR_READ_B32_e64 killed $agpr0, implicit $exec
$sgpr8_sgpr9 = S_MOV_B64 -1
diff --git a/llvm/test/CodeGen/AMDGPU/insert-handle-flat-vmem-ds.mir b/llvm/test/CodeGen/AMDGPU/insert-handle-flat-vmem-ds.mir
index 785f5bed97904..b7b3354afa086 100644
--- a/llvm/test/CodeGen/AMDGPU/insert-handle-flat-vmem-ds.mir
+++ b/llvm/test/CodeGen/AMDGPU/insert-handle-flat-vmem-ds.mir
@@ -5,6 +5,7 @@
---
name: skip_execz_flat
+tracksRegLiveness: true
body: |
; CHECK-LABEL: name: skip_execz_flat
; CHECK: bb.0:
@@ -34,6 +35,7 @@ body: |
---
name: skip_execz_mubuf
+tracksRegLiveness: true
body: |
; CHECK-LABEL: name: skip_execz_mubuf
; CHECK: bb.0:
@@ -63,6 +65,7 @@ body: |
---
name: skip_execz_ds
+tracksRegLiveness: true
body: |
; CHECK-LABEL: name: skip_execz_ds
; CHECK: bb.0:
diff --git a/llvm/test/CodeGen/AMDGPU/insert-skip-from-vcc.mir b/llvm/test/CodeGen/AMDGPU/insert-skip-from-vcc.mir
index 0004989d42408..0ff5efe8f2f6e 100644
--- a/llvm/test/CodeGen/AMDGPU/insert-skip-from-vcc.mir
+++ b/llvm/test/CodeGen/AMDGPU/insert-skip-from-vcc.mir
@@ -8,6 +8,7 @@
# GCN-NOT: S_AND_
# GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -26,6 +27,7 @@ body: |
# GCN-NOT: S_AND_
# GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_imm_vccz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -43,6 +45,7 @@ body: |
# GCN-NOT: S_AND_
# GCN: S_CBRANCH_EXECNZ %bb.1, implicit $exec
name: and_execnz_imm_vccnz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -60,6 +63,7 @@ body: |
# GCN: $vcc = S_AND_B64 $exec, -1, implicit-def $scc
# GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_imm_vccz_live_scc
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -78,6 +82,7 @@ body: |
# GCN: $vcc = S_AND_B64 $exec, -1, implicit-def $scc
# GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz_live_scc
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -96,6 +101,7 @@ body: |
# GCN: $sgpr0_sgpr1 = S_MOV_B64 -1
# GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz_live_sreg
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -114,6 +120,7 @@ body: |
# GCN: $sgpr0_sgpr1 = S_MOV_B64 -1
# GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz_live_sreg_commute
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -133,6 +140,7 @@ body: |
# GCN: $vcc = S_AND_B64 $exec, -1, implicit-def $scc
# GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz_live_scc_commute
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -152,6 +160,7 @@ body: |
# GCN-NOT: S_AND_
# GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz_commute
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -170,6 +179,7 @@ body: |
# GCN: $exec = S_MOV_B64 -1
# GCN-NEXT: S_ENDPGM 0
name: and_execz_mov_exec_vccz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -188,6 +198,7 @@ body: |
# GCN: $exec = S_MOV_B64 -1
# GCN-NEXT: S_BRANCH %bb.1{{$}}
name: and_execz_mov_exec_vccnz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -207,6 +218,7 @@ body: |
# GCN-NEXT: $sgpr2 = S_MOV_B32 $sgpr1
# GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz_reads_sreg_early
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -227,6 +239,7 @@ body: |
# GCN-NEXT: $sgpr2 = S_MOV_B32 $sgpr1
# GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz_reads_sreg_late
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -247,6 +260,7 @@ body: |
# GCN-NEXT: $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
# GCN-NEXT: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
name: and_execz_mov_vccz_reads_writes_sreg_early
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -267,6 +281,7 @@ body: |
# GCN-NEXT: $sgpr2 = S_MOV_B32 $vcc_lo
# GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz_reads_cond
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -288,6 +303,7 @@ body: |
# GCN-NEXT: $vcc = S_AND_B64 $exec, killed $sgpr0_sgpr1, implicit-def dead $scc
# GCN-NEXT: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
name: and_execz_mov_vccz_modifies_sreg
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -308,6 +324,7 @@ body: |
# GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
# GCN-NEXT: S_ENDPGM 0, implicit $scc
name: and_execz_imm_vccz_liveout_scc
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -326,6 +343,7 @@ body: |
# W32-NOT: S_AND_
# W32: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_execz_mov_vccz_w32
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -345,6 +363,7 @@ body: |
# GCN-NOT: S_ANDN2_
# GCN: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: andn2_execz_mov_vccz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -364,6 +383,7 @@ body: |
# GCN-NOT: S_ANDN2_
# GCN: S_BRANCH %bb.1
name: andn2_branch_mov_vccz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -383,6 +403,7 @@ body: |
# GCN-NOT: S_ANDN2_
# GCN: S_CBRANCH_EXECNZ %bb.1, implicit $exec
name: andn2_execnz_mov_vccnz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -403,6 +424,7 @@ body: |
# GCN-NOT: S_CBRANCH
# GCN-NOT: S_BRANCH
name: andn2_no_branch_mov_vccnz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -423,6 +445,7 @@ body: |
# GCN: $vcc = S_MOV_B64 0
# GCN-NEXT: S_BRANCH %bb.1
name: and_0_mov
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -443,6 +466,7 @@ body: |
# GCN: $vcc = S_MOV_B64 0
# GCN-NEXT: S_BRANCH %bb.1
name: andn2_m1_mov
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -463,6 +487,7 @@ body: |
# GCN: $vcc = S_MOV_B64 $exec
# GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: and_m1_mov
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -483,6 +508,7 @@ body: |
# GCN: $vcc = S_MOV_B64 $exec
# GCN-NEXT: S_CBRANCH_EXECZ %bb.1, implicit $exec
name: andn2_0_mov
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -503,6 +529,7 @@ body: |
# GCN: S_AND_
# GCN-NEXT: S_BRANCH %bb.1
name: and_0_scc_req
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -523,6 +550,7 @@ body: |
# GCN: S_ANDN2_
# GCN-NEXT: S_BRANCH %bb.1
name: andn2_m1_scc_req
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -542,6 +570,7 @@ body: |
# GCN-NOT: S_AND_
# GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
name: and_cmp_vccz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -550,6 +579,8 @@ body: |
S_NOP 0
bb.2:
+ liveins: $vgpr0, $sgpr0, $sgpr0_sgpr1
+
V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
$vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
@@ -561,6 +592,7 @@ body: |
# GCN-NOT: S_AND_
# GCN: S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
name: and_cmp_vccnz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -569,6 +601,8 @@ body: |
S_NOP 0
bb.2:
+ liveins: $vgpr0, $sgpr0, $sgpr0_sgpr1
+
V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
$vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
@@ -580,6 +614,7 @@ body: |
# GCN: $vcc = S_ANDN2_B64 $exec, $vcc, implicit-def dead $scc
# GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
name: andn2_cmp_vccz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -588,6 +623,8 @@ body: |
S_NOP 0
bb.2:
+ liveins: $vgpr0, $sgpr0, $sgpr0_sgpr1
+
V_CMP_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit $exec
$vcc = S_ANDN2_B64 $exec, $vcc, implicit-def dead $scc
S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
@@ -599,6 +636,7 @@ body: |
# GCN-NOT: S_AND_
# GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
name: and_cmpclass_vccz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -607,6 +645,8 @@ body: |
S_NOP 0
bb.2:
+ liveins: $vgpr0, $sgpr0, $sgpr0_sgpr1
+
V_CMP_CLASS_F32_e32 killed $sgpr0, killed $vgpr0, implicit-def $vcc, implicit $exec
$vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
@@ -618,6 +658,7 @@ body: |
# GCN-NOT: S_AND_
# GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
name: and_cmpx_vccz
+tracksRegLiveness: true
body: |
bb.0:
S_NOP 0
@@ -626,6 +667,8 @@ body: |
S_NOP 0
bb.2:
+ liveins: $vgpr0, $sgpr0, $sgpr0_sgpr1
+
V_CMPX_EQ_U32_e32 0, killed $vgpr0, implicit-def $vcc, implicit-def $exec, implicit $exec
$vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
@@ -638,6 +681,7 @@ body: |
# GCN: $vcc = S_AND_B64 $exec, $vcc, implicit-def dead $scc
# GCN: S_CBRANCH_VCCZ %bb.1, implicit killed $vcc
name: and_or_cmp_vccz
+track...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/207731
More information about the llvm-commits
mailing list