1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instcombine -S | FileCheck %s
3
4define i32 @assume_add(i32 %a, i32 %b) {
5; CHECK-LABEL: @assume_add(
6; CHECK-NEXT:    [[T1:%.*]] = add i32 [[A:%.*]], [[B:%.*]]
7; CHECK-NEXT:    [[LAST_TWO_DIGITS:%.*]] = and i32 [[T1]], 3
8; CHECK-NEXT:    [[T2:%.*]] = icmp eq i32 [[LAST_TWO_DIGITS]], 0
9; CHECK-NEXT:    call void @llvm.assume(i1 [[T2]])
10; CHECK-NEXT:    [[T3:%.*]] = or i32 [[T1]], 3
11; CHECK-NEXT:    ret i32 [[T3]]
12;
13  %t1 = add i32 %a, %b
14  %last_two_digits = and i32 %t1, 3
15  %t2 = icmp eq i32 %last_two_digits, 0
16  call void @llvm.assume(i1 %t2)
17  %t3 = add i32 %t1, 3
18  ret i32 %t3
19}
20
21
22define void @assume_not() {
23; CHECK-LABEL: @assume_not(
24entry-block:
25  %0 = call i1 @get_val()
26; CHECK: call void @llvm.assume
27  %1 = xor i1 %0, true
28  call void @llvm.assume(i1 %1)
29  ret void
30}
31
32declare i1 @get_val()
33declare void @llvm.assume(i1)
34