From e9a6456ab3b6e39b3203e39ca64a8031db9c28cd Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 17 Nov 2017 07:03:57 +0000 Subject: [PATCH] [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. llvm-svn: 318509 --- llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp index 73e2996..85154ff 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp @@ -1027,8 +1027,13 @@ bool DAGTypeLegalizer::CustomWidenLowerNode(SDNode *N, EVT VT) { // 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; } -- 2.7.4