[llvm] r353442 - Revert "[DAG] Cleanup of unused node in SimplifySelectCC."

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 7 10:31:06 PST 2019


Author: niravd
Date: Thu Feb  7 10:31:05 2019
New Revision: 353442

URL: http://llvm.org/viewvc/llvm-project?rev=353442&view=rev
Log:
Revert "[DAG] Cleanup of unused node in SimplifySelectCC."

Causes ASAN use-after-poison errors.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=353442&r1=353441&r2=353442&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Feb  7 10:31:05 2019
@@ -18673,21 +18673,14 @@ SDValue DAGCombiner::SimplifySelectCC(co
   auto *N3C = dyn_cast<ConstantSDNode>(N3.getNode());
 
   // Determine if the condition we're dealing with is constant.
-  if (SDValue SCC =
-          SimplifySetCC(getSetCCResultType(CmpOpVT), N0, N1, CC, DL, false)) {
-    AddToWorklist(SCC.getNode());
-    if (auto *SCCC = dyn_cast<ConstantSDNode>(SCC.getNode())) {
-      // fold select_cc true, x, y -> x
-      // fold select_cc false, x, y -> y
-      bool isNull = SCCC->isNullValue();
-      SDValue RV = isNull ? N3 : N2;
-      // Delete SCC if we don't use it.
-      if (SCCC != RV.getNode())
-        recursivelyDeleteUnusedNodes(SCCC);
-      return RV;
-    }
-    // Don't combine. Cleanup SCC.
-    recursivelyDeleteUnusedNodes(SCC.getNode());
+  SDValue SCC = SimplifySetCC(getSetCCResultType(CmpOpVT), N0, N1, CC, DL,
+                              false);
+  if (SCC.getNode()) AddToWorklist(SCC.getNode());
+
+  if (auto *SCCC = dyn_cast_or_null<ConstantSDNode>(SCC.getNode())) {
+    // fold select_cc true, x, y -> x
+    // fold select_cc false, x, y -> y
+    return !SCCC->isNullValue() ? N2 : N3;
   }
 
   if (SDValue V =




More information about the llvm-commits mailing list