1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=jump-threading -jump-threading-threshold=3 < %s | FileCheck %s
4 ; TODO: In this test case, only the stores in %join should count towards
5 ; the jump threading threshold, as everything else are free instructions.
6 define i32 @free_instructions(i1 %c, ptr %p) {
7 ; CHECK-LABEL: @free_instructions(
8 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF2:%.*]], label [[ELSE2:%.*]]
10 ; CHECK-NEXT: store i32 -1, ptr [[P:%.*]], align 4
11 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META0:![0-9]+]])
12 ; CHECK-NEXT: store i32 1, ptr [[P]], align 4, !noalias !0
13 ; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[P]], i64 32) ]
14 ; CHECK-NEXT: store i32 2, ptr [[P]], align 4
15 ; CHECK-NEXT: [[P32:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[P]])
16 ; CHECK-NEXT: store i32 3, ptr [[P32]], align 4, !invariant.group !3
17 ; CHECK-NEXT: ret i32 0
19 ; CHECK-NEXT: store i32 -2, ptr [[P]], align 4
20 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META4:![0-9]+]])
21 ; CHECK-NEXT: store i32 1, ptr [[P]], align 4, !noalias !4
22 ; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[P]], i64 32) ]
23 ; CHECK-NEXT: store i32 2, ptr [[P]], align 4
24 ; CHECK-NEXT: [[P3:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[P]])
25 ; CHECK-NEXT: store i32 3, ptr [[P3]], align 4, !invariant.group !3
26 ; CHECK-NEXT: ret i32 1
28 br i1 %c, label %if, label %else
39 call void @llvm.experimental.noalias.scope.decl(metadata !0)
40 store i32 1, ptr %p, !noalias !0
41 call void @llvm.assume(i1 true) ["align"(ptr %p, i64 32)]
43 %p3 = call ptr @llvm.launder.invariant.group.p0(ptr %p)
44 store i32 3, ptr %p3, !invariant.group !{}
45 br i1 %c, label %if2, label %else2
54 declare void @llvm.assume(i1)
55 declare void @llvm.experimental.noalias.scope.decl(metadata)
56 declare ptr @llvm.launder.invariant.group.p0(ptr)
59 !1 = distinct !{!1, !2, !"scope"}
60 !2 = distinct !{!2, !"domain"}