[llvm] [DAG] visitFREEZE - always allow freezing multiple operands (PR #145939)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 07:12:10 PDT 2025


================
@@ -11336,6 +11336,9 @@ SDValue RISCVTargetLowering::lowerINSERT_SUBVECTOR(SDValue Op,
 
   if (OrigIdx == 0 && Vec.isUndef())
     return Op;
+  if (OrigIdx == 0 && Vec.getOpcode() == ISD::FREEZE &&
+      Vec.getOperand(0).isUndef())
+    return DAG.getInsertSubvector(DL, DAG.getUNDEF(VecVT), SubVec, OrigIdx);
----------------
RKSimon wrote:

Let me have another go - lowerVectorFTRUNC_FCEIL_FFLOOR_FROUND is freezing the source value to account for increasing the number of uses, but it then converts to a scalable vector type before that which results in a freeze(insert_subvector(undef,src,0)) pattern - I think we can freeze src before hand and not freeze the widening in this case.

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


More information about the llvm-commits mailing list