[llvm] r318509 - [SelectionDAG] Allow custom vector widening through ReplaceNodeResults to handle nodes with chain outputs.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 23:03:58 PST 2017


Author: ctopper
Date: Thu Nov 16 23:03:57 2017
New Revision: 318509

URL: http://llvm.org/viewvc/llvm-project?rev=318509&view=rev
Log:
[SelectionDAG] Allow custom vector widening through ReplaceNodeResults to handle nodes with chain outputs.

Previously we were assuming all results were vectors and calling SetWidenedVector, but if its a chain result we should just replace uses instead.

This fixes an error found by expensive checks after r318368.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=318509&r1=318508&r2=318509&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Thu Nov 16 23:03:57 2017
@@ -1027,8 +1027,13 @@ bool DAGTypeLegalizer::CustomWidenLowerN
   // Update the widening map.
   assert(Results.size() == N->getNumValues() &&
          "Custom lowering returned the wrong number of results!");
-  for (unsigned i = 0, e = Results.size(); i != e; ++i)
-    SetWidenedVector(SDValue(N, i), Results[i]);
+  for (unsigned i = 0, e = Results.size(); i != e; ++i) {
+    // If this is a chain output just replace it.
+    if (Results[i].getValueType() == MVT::Other)
+      ReplaceValueWith(SDValue(N, i), Results[i]);
+    else
+      SetWidenedVector(SDValue(N, i), Results[i]);
+  }
   return true;
 }
 




More information about the llvm-commits mailing list