[llvm] f920001 - [LegalizeDAG] When expanding vector SRA/SRL/SHL add the new BUILD_VECTOR to the Results vector instead of just calling ReplaceNode

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 23:08:05 PST 2019


Author: Craig Topper
Date: 2019-12-02T23:07:39-08:00
New Revision: f92000187e149a51900c05056ed644f43603fb66

URL: https://github.com/llvm/llvm-project/commit/f92000187e149a51900c05056ed644f43603fb66
DIFF: https://github.com/llvm/llvm-project/commit/f92000187e149a51900c05056ed644f43603fb66.diff

LOG: [LegalizeDAG] When expanding vector SRA/SRL/SHL add the new BUILD_VECTOR to the Results vector instead of just calling ReplaceNode

The code that processes the Results vector also calls ReplaceNode
and makes ExpandNode return true.

If we don't add it to the Results node, we end up returning false
from ExpandNode. This causes ConvertNodeToLibcall to be called next.
But ConvertNodeToLibcall doesn't do anything for shifts so they
just pass through unmodified. Except for printing a debug message.

Ultimately, I'd like to add more checks to ExpandNode and
ConvertNodeToLibcall to make sure we don't have nodes marked as
Expand that don't have any Expand or libcall handling.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index f3316a0a303e..eab72a22cdfc 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3692,7 +3692,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
     }
 
     SDValue Result = DAG.getBuildVector(Node->getValueType(0), dl, Scalars);
-    ReplaceNode(SDValue(Node, 0), Result);
+    Results.push_back(Result);
     break;
   }
   case ISD::VECREDUCE_FADD:


        


More information about the llvm-commits mailing list