40 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4; <rdar://problem/10803154>5 6; There should be no transformation.7define i1 @f1(i32 %x) {8; CHECK-LABEL: @f1(9; CHECK-NEXT: [[A:%.*]] = trunc i32 [[X:%.*]] to i810; CHECK-NEXT: [[B:%.*]] = icmp ne i8 [[A]], 011; CHECK-NEXT: [[C:%.*]] = and i32 [[X]], 1671168012; CHECK-NEXT: [[D:%.*]] = icmp ne i32 [[C]], 013; CHECK-NEXT: [[E:%.*]] = and i1 [[B]], [[D]]14; CHECK-NEXT: ret i1 [[E]]15;16 %a = trunc i32 %x to i817 %b = icmp ne i8 %a, 018 %c = and i32 %x, 1671168019 %d = icmp ne i32 %c, 020 %e = and i1 %b, %d21 ret i1 %e22}23 24define i1 @f1_logical(i32 %x) {25; CHECK-LABEL: @f1_logical(26; CHECK-NEXT: [[A:%.*]] = trunc i32 [[X:%.*]] to i827; CHECK-NEXT: [[B:%.*]] = icmp ne i8 [[A]], 028; CHECK-NEXT: [[C:%.*]] = and i32 [[X]], 1671168029; CHECK-NEXT: [[D:%.*]] = icmp ne i32 [[C]], 030; CHECK-NEXT: [[E:%.*]] = and i1 [[B]], [[D]]31; CHECK-NEXT: ret i1 [[E]]32;33 %a = trunc i32 %x to i834 %b = icmp ne i8 %a, 035 %c = and i32 %x, 1671168036 %d = icmp ne i32 %c, 037 %e = select i1 %b, i1 %d, i1 false38 ret i1 %e39}40