[llvm] [GlobalISel] Fix crash in isConstantOrConstantSplatVectorFP for non-r… (PR #208657)

Mateusz Chudyk via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 02:42:15 PDT 2026


================
@@ -0,0 +1,27 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -o - -mtriple=aarch64 -run-pass=aarch64-prelegalizer-combiner %s | FileCheck %s
+
+---
+name:            fdiv_inlineasm_numerator
+alignment:       4
+legalized:       false
+regBankSelected: false
+selected:        false
+tracksRegLiveness: true
+body:             |
+  bb.0:
+    ; Regression test for isConstantOrConstantSplatVectorFP.
+    ; When G_FDIV's numerator is defined by INLINEASM, the combiner must not
+    ; crash by assuming operand 0 of the defining instruction is a register.
+    ; CHECK-LABEL: name: fdiv_inlineasm_numerator
+    ; CHECK: %y:_(s32) = G_FCONSTANT float 2.000000e+00
+    ; CHECK-NEXT: INLINEASM &"fmov $0, #1.0", sideeffect attdialect, regdef:FPR32, def %x(s32)
+    ; CHECK-NEXT: %div:_(s32) = arcp G_FDIV %x, %y
+    ; CHECK-NEXT: $s0 = COPY %div(s32)
+    ; CHECK-NEXT: RET_ReallyLR implicit $s0
+    %y:_(s32) = G_FCONSTANT float 2.0
+    INLINEASM &"fmov $0, #1.0", sideeffect attdialect, regdef:FPR32, def %x:fpr32(s32)
+    %div:_(s32) = arcp G_FDIV %x:fpr32(s32), %y:_(s32)
----------------
mateuszchudyk wrote:

Done.

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


More information about the llvm-commits mailing list