[llvm] DAG: Fix losing flags on select when expanding select_cc (PR #93662)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 03:32:53 PDT 2024


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/93662

This was only preserving the flags on the setcc, not the new select. This was missing presumably due to getSelect not having a flags argument until recently. Avoids regressions in a future commit.

>From 44c7a95bf04d789a18e36f60a1c1099d9049b36e Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Tue, 28 May 2024 20:05:20 +0200
Subject: [PATCH] DAG: Fix losing flags on select when expanding select_cc

This was only preserving the flags on the setcc, not the new select.
This was missing presumably due to getSelect not having a flags argument
until recently. Avoids regressions in a future commit.
---
 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index bfc2273c9425c..51f2cf9017f85 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -4159,7 +4159,8 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
              "expanded.");
       EVT CCVT = getSetCCResultType(CmpVT);
       SDValue Cond = DAG.getNode(ISD::SETCC, dl, CCVT, Tmp1, Tmp2, CC, Node->getFlags());
-      Results.push_back(DAG.getSelect(dl, VT, Cond, Tmp3, Tmp4));
+      Results.push_back(
+          DAG.getSelect(dl, VT, Cond, Tmp3, Tmp4, Node->getFlags()));
       break;
     }
 



More information about the llvm-commits mailing list