[llvm] SPIRV: Set NoPHIs property after selection (PR #136327)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 10:02:23 PDT 2025


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/136327

There should be no PHIs after selection, as OpPhi is used
instead. This hopefully avoids errors in #135277.

>From 829c3649ae00f233e3ceb64a9951783e8eb7e4a8 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 18 Apr 2025 19:01:16 +0200
Subject: [PATCH] SPIRV: Set NoPHIs property after selection

There should be no PHIs after selection, as OpPhi is used
instead. This hopefully avoids errors in #135277.
---
 llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp b/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
index 68286737b972f..f30578767a939 100644
--- a/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
@@ -269,6 +269,12 @@ class SPIRVInstructionSelect : public InstructionSelect {
     return InstructionSelect::getRequiredProperties().reset(
         MachineFunctionProperties::Property::RegBankSelected);
   }
+
+  MachineFunctionProperties getClearedProperties() const override {
+    // No generic Phis remain, replaced with OpPhi
+    return InstructionSelect::getClearedProperties().reset(
+        MachineFunctionProperties::Property::NoPHIs);
+  }
 };
 } // namespace
 



More information about the llvm-commits mailing list