[llvm] WIP: AMDGPU: Use MFPropsModifier modifier in SIFoldOperands (PR #127752)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 22:26:32 PST 2025
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/127752
This doesn't appear to work. I do not get an error in the new PM.
>From 9f789fb5e604536607282b3b24c3cbb939d1d132 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 19 Feb 2025 13:25:24 +0700
Subject: [PATCH] WIP: AMDGPU: Use MFPropsModifier modifier in SIFoldOperands
This doesn't appear to work. I do not get an error in the new PM.
---
llvm/lib/Target/AMDGPU/SIFoldOperands.cpp | 2 ++
.../AMDGPU/si-fold-operands-requires-ssa.mir | 15 +++++++++++++++
2 files changed, 17 insertions(+)
create mode 100644 llvm/test/CodeGen/AMDGPU/si-fold-operands-requires-ssa.mir
diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
index ab396929162d0..54baf90d95a12 100644
--- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
@@ -2311,6 +2311,8 @@ bool SIFoldOperandsImpl::tryOptimizeAGPRPhis(MachineBasicBlock &MBB) {
}
bool SIFoldOperandsImpl::run(MachineFunction &MF) {
+ MFPropsModifier _(*this, MF);
+
MRI = &MF.getRegInfo();
ST = &MF.getSubtarget<GCNSubtarget>();
TII = ST->getInstrInfo();
diff --git a/llvm/test/CodeGen/AMDGPU/si-fold-operands-requires-ssa.mir b/llvm/test/CodeGen/AMDGPU/si-fold-operands-requires-ssa.mir
new file mode 100644
index 0000000000000..9cad4eeab76c8
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/si-fold-operands-requires-ssa.mir
@@ -0,0 +1,15 @@
+# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=si-fold-operands -filetype=null %s 2>&1 | FileCheck -check-prefix=ERR %s
+# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx900 -passes=si-fold-operands -filetype=null %s 2>&1 | FileCheck -check-prefix=ERR %s
+
+# ERR: MachineFunctionProperties required by SI Fold Operands pass are not met by function not_ssa.
+# ERR-NEXT: Required properties: IsSSA
+# ERR-NEXT: Current properties: NoPHIs
+---
+name: not_ssa
+body: |
+ bb.0:
+ liveins: $vgpr0, $vgpr1
+ %0:vgpr_32 = COPY $vgpr0
+ %0:vgpr_32 = COPY $vgpr1
+
+...
More information about the llvm-commits
mailing list