mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
[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
This commit is contained in:
parent
345940ba6e
commit
e9389ff507
@ -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);
|
||||
|
@ -183,3 +183,27 @@ define i32 @test_gt_2(<4 x i32> %A, <4 x i32> %B) {
|
||||
ret i32 %t1
|
||||
}
|
||||
|
||||
; (and (setne X, 0), (setne X, -1)) --> (setuge (add X, 1), 2)
|
||||
; Don't combine with i1 - out of range constant
|
||||
define void @test_i1_uge(i1 *%A2) {
|
||||
; CHECK-LABEL: test_i1_uge:
|
||||
; CHECK: # %bb.0:
|
||||
; CHECK-NEXT: movb (%rdi), %al
|
||||
; CHECK-NEXT: movl %eax, %ecx
|
||||
; CHECK-NEXT: xorb $1, %cl
|
||||
; CHECK-NEXT: andb %cl, %al
|
||||
; CHECK-NEXT: movzbl %al, %eax
|
||||
; CHECK-NEXT: andl $1, %eax
|
||||
; CHECK-NEXT: negq %rax
|
||||
; CHECK-NEXT: andb $1, %cl
|
||||
; CHECK-NEXT: movb %cl, (%rdi,%rax)
|
||||
; CHECK-NEXT: retq
|
||||
%L5 = load i1, i1* %A2
|
||||
%C3 = icmp ne i1 %L5, true
|
||||
%C8 = icmp eq i1 %L5, false
|
||||
%C9 = icmp ugt i1 %C3, %C8
|
||||
%G3 = getelementptr i1, i1* %A2, i1 %C9
|
||||
store i1 %C3, i1* %G3
|
||||
ret void
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user