From 9196f5dab757cc2d2f59b5295140fb1f7f4354c2 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 13 Apr 2022 10:45:27 -0400 Subject: [PATCH] MachineCSE: Report this requires SSA --- llvm/lib/CodeGen/MachineCSE.cpp | 5 +++++ llvm/test/CodeGen/AMDGPU/machine-cse-ssa.mir | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 llvm/test/CodeGen/AMDGPU/machine-cse-ssa.mir diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp index 148947494355d..e60fd9f7883a8 100644 --- a/llvm/lib/CodeGen/MachineCSE.cpp +++ b/llvm/lib/CodeGen/MachineCSE.cpp @@ -90,6 +90,11 @@ namespace { AU.addPreserved(); } + MachineFunctionProperties getRequiredProperties() const override { + return MachineFunctionProperties() + .set(MachineFunctionProperties::Property::IsSSA); + } + void releaseMemory() override { ScopeMap.clear(); PREMap.clear(); diff --git a/llvm/test/CodeGen/AMDGPU/machine-cse-ssa.mir b/llvm/test/CodeGen/AMDGPU/machine-cse-ssa.mir new file mode 100644 index 0000000000000..89b204d715ded --- /dev/null +++ b/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 +...