xref: /llvm-project/llvm/test/Transforms/InstCombine/2008-06-21-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; PR2479
5; (See also PR1800.)
6
7define i1 @test(i32 %In) {
8; CHECK-LABEL: @test(
9; CHECK-NEXT:    [[C2:%.*]] = icmp eq i32 [[IN:%.*]], 15
10; CHECK-NEXT:    ret i1 [[C2]]
11;
12  %c1 = icmp ugt i32 %In, 13
13  %c2 = icmp eq i32 %In, 15
14  %V = and i1 %c1, %c2
15  ret i1 %V
16}
17
18define i1 @test_logical(i32 %In) {
19; CHECK-LABEL: @test_logical(
20; CHECK-NEXT:    [[C2:%.*]] = icmp eq i32 [[IN:%.*]], 15
21; CHECK-NEXT:    ret i1 [[C2]]
22;
23  %c1 = icmp ugt i32 %In, 13
24  %c2 = icmp eq i32 %In, 15
25  %V = select i1 %c1, i1 %c2, i1 false
26  ret i1 %V
27}
28
29