diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 5 |
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) { |

