1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
4 ; RUN: opt -passes='assume-builder,verify' --enable-knowledge-retention --debug-counter=assume-builder-counter-skip=5,assume-builder-counter-count=1 -S %s | FileCheck %s --check-prefixes=COUNTER1
5 ; RUN: opt -passes='assume-builder,verify' --enable-knowledge-retention --debug-counter=assume-builder-counter-skip=1,assume-builder-counter-count=3 -S %s | FileCheck %s --check-prefixes=COUNTER2
6 ; RUN: opt -passes='assume-builder,verify' --enable-knowledge-retention --debug-counter=assume-builder-counter-skip=2,assume-builder-counter-count=200 -S %s | FileCheck %s --check-prefixes=COUNTER3
8 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
10 declare void @func(i32*, i32*)
11 declare void @func_cold(i32*) cold willreturn nounwind
12 declare void @func_strbool(i32*) "no-jump-tables"
13 declare void @func_many(i32*) "no-jump-tables" nounwind "less-precise-fpmad" willreturn norecurse
14 declare void @func_argattr(i32* align 8, i32* nonnull) nounwind
15 declare void @func_argattr2(i32* noundef align 8, i32* noundef nonnull) nounwind
16 declare void @may_throw()
18 define void @test(i32* %P, i32* %P1, i32* %P2, i32* %P3) {
19 ; COUNTER1-LABEL: define {{[^@]+}}@test
20 ; COUNTER1-SAME: (i32* [[P:%.*]], i32* [[P1:%.*]], i32* [[P2:%.*]], i32* [[P3:%.*]]) {
21 ; COUNTER1-NEXT: call void @func(i32* nonnull dereferenceable(16) [[P]], i32* null)
22 ; COUNTER1-NEXT: call void @func(i32* dereferenceable(12) [[P1]], i32* nonnull [[P]])
23 ; COUNTER1-NEXT: call void @func_cold(i32* dereferenceable(12) [[P1]]) [[ATTR5:#.*]]
24 ; COUNTER1-NEXT: call void @func_cold(i32* dereferenceable(12) [[P1]])
25 ; COUNTER1-NEXT: call void @func(i32* [[P1]], i32* [[P]])
26 ; COUNTER1-NEXT: call void @func_strbool(i32* [[P1]])
27 ; COUNTER1-NEXT: call void @func(i32* dereferenceable(32) [[P]], i32* dereferenceable(8) [[P]])
28 ; COUNTER1-NEXT: call void @func_many(i32* align 8 [[P1]])
29 ; COUNTER1-NEXT: call void @llvm.assume(i1 true) [ "noundef"(i32* [[P1]]), "align"(i32* [[P1]], i64 8) ]
30 ; COUNTER1-NEXT: call void @func_many(i32* noundef align 8 [[P1]])
31 ; COUNTER1-NEXT: call void @func_argattr(i32* [[P2]], i32* [[P3]])
32 ; COUNTER1-NEXT: call void @func_argattr2(i32* [[P2]], i32* [[P3]])
33 ; COUNTER1-NEXT: call void @func(i32* nonnull [[P1]], i32* nonnull [[P]])
34 ; COUNTER1-NEXT: call void @func(i32* noundef nonnull [[P1]], i32* noundef nonnull [[P]])
35 ; COUNTER1-NEXT: ret void
37 ; COUNTER2-LABEL: define {{[^@]+}}@test
38 ; COUNTER2-SAME: (i32* [[P:%.*]], i32* [[P1:%.*]], i32* [[P2:%.*]], i32* [[P3:%.*]]) {
39 ; COUNTER2-NEXT: call void @func(i32* nonnull dereferenceable(16) [[P]], i32* null)
40 ; COUNTER2-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(i32* [[P1]], i64 12) ]
41 ; COUNTER2-NEXT: call void @func(i32* dereferenceable(12) [[P1]], i32* nonnull [[P]])
42 ; COUNTER2-NEXT: call void @llvm.assume(i1 true) [ "cold"() ]
43 ; COUNTER2-NEXT: call void @func_cold(i32* dereferenceable(12) [[P1]]) [[ATTR5:#.*]]
44 ; COUNTER2-NEXT: call void @llvm.assume(i1 true) [ "cold"() ]
45 ; COUNTER2-NEXT: call void @func_cold(i32* dereferenceable(12) [[P1]])
46 ; COUNTER2-NEXT: call void @func(i32* [[P1]], i32* [[P]])
47 ; COUNTER2-NEXT: call void @func_strbool(i32* [[P1]])
48 ; COUNTER2-NEXT: call void @func(i32* dereferenceable(32) [[P]], i32* dereferenceable(8) [[P]])
49 ; COUNTER2-NEXT: call void @func_many(i32* align 8 [[P1]])
50 ; COUNTER2-NEXT: call void @func_many(i32* noundef align 8 [[P1]])
51 ; COUNTER2-NEXT: call void @func_argattr(i32* [[P2]], i32* [[P3]])
52 ; COUNTER2-NEXT: call void @func_argattr2(i32* [[P2]], i32* [[P3]])
53 ; COUNTER2-NEXT: call void @func(i32* nonnull [[P1]], i32* nonnull [[P]])
54 ; COUNTER2-NEXT: call void @func(i32* noundef nonnull [[P1]], i32* noundef nonnull [[P]])
55 ; COUNTER2-NEXT: ret void
57 ; COUNTER3-LABEL: define {{[^@]+}}@test
58 ; COUNTER3-SAME: (i32* [[P:%.*]], i32* [[P1:%.*]], i32* [[P2:%.*]], i32* [[P3:%.*]]) {
59 ; COUNTER3-NEXT: call void @func(i32* nonnull dereferenceable(16) [[P]], i32* null)
60 ; COUNTER3-NEXT: call void @func(i32* dereferenceable(12) [[P1]], i32* nonnull [[P]])
61 ; COUNTER3-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(i32* [[P1]], i64 12), "cold"() ]
62 ; COUNTER3-NEXT: call void @func_cold(i32* dereferenceable(12) [[P1]]) [[ATTR5:#.*]]
63 ; COUNTER3-NEXT: call void @llvm.assume(i1 true) [ "cold"() ]
64 ; COUNTER3-NEXT: call void @func_cold(i32* dereferenceable(12) [[P1]])
65 ; COUNTER3-NEXT: call void @func(i32* [[P1]], i32* [[P]])
66 ; COUNTER3-NEXT: call void @func_strbool(i32* [[P1]])
67 ; COUNTER3-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(i32* [[P]], i64 32) ]
68 ; COUNTER3-NEXT: call void @func(i32* dereferenceable(32) [[P]], i32* dereferenceable(8) [[P]])
69 ; COUNTER3-NEXT: call void @func_many(i32* align 8 [[P1]])
70 ; COUNTER3-NEXT: call void @llvm.assume(i1 true) [ "noundef"(i32* [[P1]]), "align"(i32* [[P1]], i64 8) ]
71 ; COUNTER3-NEXT: call void @func_many(i32* noundef align 8 [[P1]])
72 ; COUNTER3-NEXT: call void @func_argattr(i32* [[P2]], i32* [[P3]])
73 ; COUNTER3-NEXT: call void @llvm.assume(i1 true) [ "noundef"(i32* [[P2]]), "align"(i32* [[P2]], i64 8), "noundef"(i32* [[P3]]), "nonnull"(i32* [[P3]]) ]
74 ; COUNTER3-NEXT: call void @func_argattr2(i32* [[P2]], i32* [[P3]])
75 ; COUNTER3-NEXT: call void @func(i32* nonnull [[P1]], i32* nonnull [[P]])
76 ; COUNTER3-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(i32* [[P1]]), "noundef"(i32* [[P]]), "nonnull"(i32* [[P]]) ]
77 ; COUNTER3-NEXT: call void @func(i32* noundef nonnull [[P1]], i32* noundef nonnull [[P]])
78 ; COUNTER3-NEXT: ret void
80 call void @func(i32* nonnull dereferenceable(16) %P, i32* null)
81 call void @func(i32* dereferenceable(12) %P1, i32* nonnull %P)
82 call void @func_cold(i32* dereferenceable(12) %P1) cold
83 call void @func_cold(i32* dereferenceable(12) %P1)
84 call void @func(i32* %P1, i32* %P)
85 call void @func_strbool(i32* %P1)
86 call void @func(i32* dereferenceable(32) %P, i32* dereferenceable(8) %P)
87 call void @func_many(i32* align 8 %P1)
88 call void @func_many(i32* align 8 noundef %P1)
89 call void @func_argattr(i32* %P2, i32* %P3)
90 call void @func_argattr2(i32* %P2, i32* %P3)
91 call void @func(i32* nonnull %P1, i32* nonnull %P)
92 call void @func(i32* nonnull noundef %P1, i32* nonnull noundef %P)