[llvm] [SPIR-V] Add PreLegalizer pattern matching for ldexp (PR #227126)

Arseniy Obolenskiy via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 21:28:10 PDT 2026


================
@@ -200,6 +207,68 @@ void SPIRVCombinerHelper::applySPIRVFaceForward(MachineInstr &MI) const {
   MI.eraseFromParent();
 }
 
+/// Ignores spv_assign_type and spv_assign_name, which the pre-legalizer drops.
+static bool hasOneRealUse(Register Reg, MachineRegisterInfo &MRI) {
+  return count_if(MRI.use_nodbg_instructions(Reg), [](MachineInstr &UseMI) {
+           return !isSpvIntrinsic(UseMI, Intrinsic::spv_assign_type) &&
+                  !isSpvIntrinsic(UseMI, Intrinsic::spv_assign_name);
+         }) == 1;
+}
----------------
aobolensk wrote:

Looks good, applied, thanks

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


More information about the llvm-commits mailing list