xref: /llvm-project/llvm/test/Transforms/InstCombine/2007-11-15-CompareMiscomp.ll (revision acdc419c897f8a9414c7a00c8908ac32312afee2)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3
4; PR1800
5
6define i1 @test(i32 %In) {
7; CHECK-LABEL: @test(
8; CHECK-NEXT:    [[C2:%.*]] = icmp eq i32 [[IN:%.*]], 1
9; CHECK-NEXT:    ret i1 [[C2]]
10;
11  %c1 = icmp sgt i32 %In, -1
12  %c2 = icmp eq i32 %In, 1
13  %V = and i1 %c1, %c2
14  ret i1 %V
15}
16
17define i1 @test_logical(i32 %In) {
18; CHECK-LABEL: @test_logical(
19; CHECK-NEXT:    [[C2:%.*]] = icmp eq i32 [[IN:%.*]], 1
20; CHECK-NEXT:    ret i1 [[C2]]
21;
22  %c1 = icmp sgt i32 %In, -1
23  %c2 = icmp eq i32 %In, 1
24  %V = select i1 %c1, i1 %c2, i1 false
25  ret i1 %V
26}
27
28