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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 00:31:15 PDT 2025


================
@@ -23205,6 +23196,10 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
       if (CurVec.isUndef())
         return CanonicalizeBuildVector(Ops);
 
+      // FREEZE(UNDEF) - build new BUILD_VECTOR from already inserted operands.
+      if (ISD::isFreezeUndef(CurVec.getNode()))
+        return CanonicalizeBuildVector(Ops, /*FreezeUndef=*/true);
----------------
nikic wrote:

So this relies on DAG automatically uniquing the freeze so all the operands are the same right?

It's still not strictly correct if the original freeze is multi-use...

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


More information about the llvm-commits mailing list