summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-09-19 21:48:30 +0000
committerSanjay Patel <spatel@rotateright.com>2018-09-19 21:48:30 +0000
commitfdc0de19cb228bb1768b3dd882e79f8a0c5d6112 (patch)
tree607208558c4038e299eae2f1443319e1bdc3839e /llvm/lib
parent67fb2134c09f33cfc44142c52b5c896a0851daad (diff)
downloadbcm5719-llvm-fdc0de19cb228bb1768b3dd882e79f8a0c5d6112.tar.gz
bcm5719-llvm-fdc0de19cb228bb1768b3dd882e79f8a0c5d6112.zip
[SelectionDAG] allow vector types with isBitwiseNot()
The test diff in not-and-simplify.ll is from a use in SimplifyDemandedBits, and the test diff in add.ll is from a DAGCombiner transform. llvm-svn: 342594
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp4
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp5
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index df015433287..1c80c384310 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -2009,10 +2009,8 @@ static SDValue foldAddSubOfSignBit(SDNode *N, SelectionDAG &DAG) {
return SDValue();
// The shift must be of a 'not' value.
- // TODO: Use isBitwiseNot() if it works with vectors.
SDValue Not = ShiftOp.getOperand(0);
- if (!Not.hasOneUse() || Not.getOpcode() != ISD::XOR ||
- !isAllOnesConstantOrAllOnesSplatConstant(Not.getOperand(1)))
+ if (!Not.hasOneUse() || !isBitwiseNot(Not))
return SDValue();
// The shift must be moving the sign bit to the least-significant-bit.
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index afe7bfbf9f5..5c8e8e5b14d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -8191,7 +8191,10 @@ bool llvm::isOneConstant(SDValue V) {
}
bool llvm::isBitwiseNot(SDValue V) {
- return V.getOpcode() == ISD::XOR && isAllOnesConstant(V.getOperand(1));
+ if (V.getOpcode() != ISD::XOR)
+ return false;
+ ConstantSDNode *C = isConstOrConstSplat(V.getOperand(1));
+ return C && C->isAllOnesValue();
}
ConstantSDNode *llvm::isConstOrConstSplat(SDValue N) {
OpenPOWER on IntegriCloud