blob: d65a8f7bc5e24a77c6e454417fbc5c8e8c1a1cf1 [file] [log] [blame]
Hal Finkelf5867a72014-07-25 21:45:17 +00001; RUN: opt < %s -instcombine -S | FileCheck %s
2target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3target triple = "x86_64-unknown-linux-gnu"
4
5; Function Attrs: nounwind
6declare void @llvm.assume(i1) #1
7
8; Function Attrs: nounwind uwtable
9define i32 @can1(i1 %a, i1 %b, i1 %c) {
10entry:
11 %and1 = and i1 %a, %b
12 %and = and i1 %and1, %c
13 tail call void @llvm.assume(i1 %and)
14
15; CHECK-LABEL: @can1
16; CHECK: call void @llvm.assume(i1 %a)
17; CHECK: call void @llvm.assume(i1 %b)
18; CHECK: call void @llvm.assume(i1 %c)
19; CHECK: ret i32
20
21 ret i32 5
22}
23
24; Function Attrs: nounwind uwtable
25define i32 @can2(i1 %a, i1 %b, i1 %c) {
26entry:
27 %v = or i1 %a, %b
28 %w = xor i1 %v, 1
29 tail call void @llvm.assume(i1 %w)
30
31; CHECK-LABEL: @can2
32; CHECK: %[[V1:[^ ]+]] = xor i1 %a, true
33; CHECK: call void @llvm.assume(i1 %[[V1]])
34; CHECK: %[[V2:[^ ]+]] = xor i1 %b, true
35; CHECK: call void @llvm.assume(i1 %[[V2]])
36; CHECK: ret i32
37
38 ret i32 5
39}
40
41attributes #0 = { nounwind uwtable }
42attributes #1 = { nounwind }
43