Skip to content

Commit

Permalink
MachineCSE: Report this requires SSA
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenm committed Apr 15, 2022
1 parent 6f3f19a commit 9196f5d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions llvm/lib/CodeGen/MachineCSE.cpp
Expand Up @@ -90,6 +90,11 @@ namespace {
AU.addPreserved<MachineBlockFrequencyInfo>();
}

MachineFunctionProperties getRequiredProperties() const override {
return MachineFunctionProperties()
.set(MachineFunctionProperties::Property::IsSSA);
}

void releaseMemory() override {
ScopeMap.clear();
PREMap.clear();
Expand Down
15 changes: 15 additions & 0 deletions llvm/test/CodeGen/AMDGPU/machine-cse-ssa.mir
@@ -0,0 +1,15 @@
# REQUIRES: asserts
# RUN: not --crash llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=machine-cse -o /dev/null %s 2>&1 | FileCheck -check-prefix=ERR %s

# ERR: MachineFunctionProperties required by Machine Common Subexpression Elimination pass are not met by function not_ssa.
# ERR-NEXT: Required properties: IsSSA
# ERR-NEXT: Current properties: NoPHIs

---
name: not_ssa
body: |
bb.0:
%0:sgpr_32 = S_MOV_B32 0
%0:sgpr_32 = S_MOV_B32 1
S_ENDPGM 0, implicit %0
...

0 comments on commit 9196f5d

Please sign in to comment.