[llvm-branch-commits] [llvm] DAG: Preserve poison in more concat_vectors folds (PR #206948)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jul 1 06:09:12 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-selectiondag
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
Avoid degrading poison to undef.
---
Full diff: https://github.com/llvm/llvm-project/pull/206948.diff
1 Files Affected:
- (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (+6-2)
``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 28160dcd8100a..34be92d3c847f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -7024,7 +7024,9 @@ static SDValue foldCONCAT_VECTORS(const SDLoc &DL, EVT VT,
SmallVector<SDValue, 16> Elts;
for (SDValue Op : Ops) {
EVT OpVT = Op.getValueType();
- if (Op.isUndef())
+ if (Op.getOpcode() == ISD::POISON)
+ Elts.append(OpVT.getVectorNumElements(), DAG.getPOISON(SVT));
+ else if (Op.getOpcode() == ISD::UNDEF)
Elts.append(OpVT.getVectorNumElements(), DAG.getUNDEF(SVT));
else if (Op.getOpcode() == ISD::BUILD_VECTOR)
Elts.append(Op->op_begin(), Op->op_end());
@@ -7043,7 +7045,9 @@ static SDValue foldCONCAT_VECTORS(const SDLoc &DL, EVT VT,
if (SVT.bitsGT(VT.getScalarType())) {
for (SDValue &Op : Elts) {
- if (Op.isUndef())
+ if (Op.getOpcode() == ISD::POISON)
+ Op = DAG.getPOISON(SVT);
+ else if (Op.getOpcode() == ISD::UNDEF)
Op = DAG.getUNDEF(SVT);
else
Op = DAG.getTargetLoweringInfo().isZExtFree(Op.getValueType(), SVT)
``````````
</details>
https://github.com/llvm/llvm-project/pull/206948
More information about the llvm-branch-commits
mailing list