Skip to content

AMDGPU: Use MFPropsModifier modifier in SIFoldOperands #127752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2397,6 +2397,8 @@ bool SIFoldOperandsImpl::run(MachineFunction &MF) {

PreservedAnalyses SIFoldOperandsPass::run(MachineFunction &MF,
MachineFunctionAnalysisManager &) {
MFPropsModifier _(*this, MF);

bool Changed = SIFoldOperandsImpl().run(MF);
if (!Changed) {
return PreservedAnalyses::all();
Expand Down
16 changes: 16 additions & 0 deletions llvm/test/CodeGen/AMDGPU/si-fold-operands-requires-ssa.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=si-fold-operands -filetype=null %s 2>&1 | FileCheck -check-prefixes=ERR-LEGACY,ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx900 -passes=si-fold-operands -filetype=null %s 2>&1 | FileCheck -check-prefixes=ERR-NPM,ERR %s

# ERR-LEGACY: MachineFunctionProperties required by SI Fold Operands pass are not met by function not_ssa.
# ERR-NPM: MachineFunctionProperties required by SIFoldOperandsPass pass are not met by function not_ssa.
# ERR-NEXT: Required properties: IsSSA
# ERR-NEXT: Current properties: NoPHIs
Comment on lines +4 to +7
Copy link
Contributor

@optimisan optimisan Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still no error with the new PM

This is the error right? The test passes now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the test is failing on the bot. And fails for me locally. There is no error produced

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, checked again. Will take a look

---
name: not_ssa
body: |
bb.0:
liveins: $vgpr0, $vgpr1
%0:vgpr_32 = COPY $vgpr0
%0:vgpr_32 = COPY $vgpr1

...
Loading