[llvm] [SPIRV] Implement lowering for HLSL Texture2D sampling intrinsics (PR #179312)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 5 02:33:31 PST 2026


================
@@ -3122,6 +3148,47 @@ bool SPIRVInstructionSelector::isScalarOrVectorIntConstantZero(
   return false;
 }
 
+bool SPIRVInstructionSelector::isScalarOrVectorConstant(Register Reg) const {
+  auto IsConstant = [this](Register Reg) {
+    MachineInstr *Def = getDefInstrMaybeConstant(Reg, MRI);
+    if (!Def)
+      return false;
+
+    if (TII.isConstantInstr(*Def))
+      return true;
+
+    if (Def->getOpcode() == TargetOpcode::G_CONSTANT ||
+        Def->getOpcode() == TargetOpcode::G_FCONSTANT)
----------------
Keenuts wrote:

Should those 2 opcodes be added to the `isConstantInstr` switch instead?

https://github.com/llvm/llvm-project/pull/179312


More information about the llvm-commits mailing list