summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2017-12-26 14:48:28 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2017-12-26 14:48:28 +0000
commit628f63e5fd2143466c87f88ebbbfadca0ad3b1d9 (patch)
tree0cc4b0adbc218234fff58d00aebb1b5b4e7c6dae /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent79c2c2f08c8513be679b2ff8ad3a53b2db3343d9 (diff)
downloadbcm5719-llvm-628f63e5fd2143466c87f88ebbbfadca0ad3b1d9.tar.gz
bcm5719-llvm-628f63e5fd2143466c87f88ebbbfadca0ad3b1d9.zip
[DAGCombine] Don't combine (and (setne X, 0), (setne X, -1)) --> (setuge (add X, 1), 2) for i1
Reduced from oss-fuzz #4773 test case llvm-svn: 321455
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 388663eb1db..d2b06ec0a4b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3577,7 +3577,8 @@ SDValue DAGCombiner::foldLogicOfSetCCs(bool IsAnd, SDValue N0, SDValue N1,
// TODO: What is the 'or' equivalent of this fold?
// (and (setne X, 0), (setne X, -1)) --> (setuge (add X, 1), 2)
- if (IsAnd && LL == RL && CC0 == CC1 && IsInteger && CC0 == ISD::SETNE &&
+ if (IsAnd && LL == RL && CC0 == CC1 && OpVT.getScalarSizeInBits() > 1 &&
+ IsInteger && CC0 == ISD::SETNE &&
((isNullConstant(LR) && isAllOnesConstant(RR)) ||
(isAllOnesConstant(LR) && isNullConstant(RR)))) {
SDValue One = DAG.getConstant(1, DL, OpVT);
OpenPOWER on IntegriCloud