[llvm] [DAGCombiner] Avoid illegal scalar nodes in estimate refinement (PR #219394)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 16:03:30 PDT 2026


================

----------------
MattPD wrote:

For `VT` itself, `ConstantFP` legality gives the same answer as `isTypeLegal`, because `isOperationLegal(ISD::ConstantFP, v4f32)` is true on i686 with SSE1 but no SSE2 or x87, the configuration this patch fixes. That action is also never used on this path, because `getConstantFP` builds a `BUILD_VECTOR` of scalar `ConstantFP` operands and creates no `ConstantFP` node of type `VT`. `isTypeLegal(VT)` limits the helper to the legal-vector configuration that exposes the failure.

For the element type, the type action names the failing case directly. `SoftenFloatOperand` has no `BUILD_VECTOR` case, while `SoftPromoteHalfOperand` and `ExpandFloatOperand` do.

A rule that takes the constant-pool path whenever the scalar `ConstantFP` is not legal would apply to every X86 subtarget, because the action defaults to `Expand` and X86 never changes it. The early load would also hide the constant from later DAG combines.

I added a comment explaining both checks.


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


More information about the llvm-commits mailing list