summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-11-05 05:53:06 +0000
committerCraig Topper <craig.topper@intel.com>2018-11-05 05:53:06 +0000
commit8f2f2a76b9e954fe352319ac7cc00211c85c702c (patch)
tree5c19c890825b5d4a5de0a69b58a7bc4b40823482 /llvm/lib/CodeGen
parent8d64abddd1cea5385b3db8dedf89d2b3fe5fb99f (diff)
downloadbcm5719-llvm-8f2f2a76b9e954fe352319ac7cc00211c85c702c.tar.gz
bcm5719-llvm-8f2f2a76b9e954fe352319ac7cc00211c85c702c.zip
[DAGCombiner] Use tryFoldToZero to simplify some code and make it work correctly between LegalTypes and LegalOperations.
The original code avoided creating a zero vector after type legalization, but if we're after type legalization the type we have is legal. The real hazard we need to avoid is creating a build vector after op legalization. tryFoldToZero takes care of checking for this. llvm-svn: 346119
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 395d855a18f..fc0e8efebdc 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3839,10 +3839,7 @@ SDValue DAGCombiner::SimplifyBinOpWithSameOpcodeHands(SDNode *N) {
// Don't try to fold this node if it requires introducing a
// build vector of all zeros that might be illegal at this stage.
if (N->getOpcode() == ISD::XOR && !ShOp.isUndef()) {
- if (!LegalTypes)
- ShOp = DAG.getConstant(0, SDLoc(N), VT);
- else
- ShOp = SDValue();
+ ShOp = tryFoldToZero(SDLoc(N), TLI, VT, DAG, LegalOperations);
}
// (AND (shuf (A, C), shuf (B, C))) -> shuf (AND (A, B), C)
@@ -3860,10 +3857,7 @@ SDValue DAGCombiner::SimplifyBinOpWithSameOpcodeHands(SDNode *N) {
// build vector of all zeros that might be illegal at this stage.
ShOp = N0->getOperand(0);
if (N->getOpcode() == ISD::XOR && !ShOp.isUndef()) {
- if (!LegalTypes)
- ShOp = DAG.getConstant(0, SDLoc(N), VT);
- else
- ShOp = SDValue();
+ ShOp = tryFoldToZero(SDLoc(N), TLI, VT, DAG, LegalOperations);
}
// (AND (shuf (C, A), shuf (C, B))) -> shuf (C, AND (A, B))
OpenPOWER on IntegriCloud