1 ; RUN: opt < %s -basic-aa -dse -S | FileCheck %s
3 ; CHECK-LABEL: void @skipBarrier(i8* %ptr)
4 define void @skipBarrier(i8* %ptr) {
5 ; CHECK-NOT: store i8 42
7 ; CHECK: %ptr2 = call i8* @llvm.launder.invariant.group.p0i8(i8* %ptr)
8 %ptr2 = call i8* @llvm.launder.invariant.group.p0i8(i8* %ptr)
10 store i8 43, i8* %ptr2
14 ; CHECK-LABEL: void @skip2Barriers(i8* %ptr)
15 define void @skip2Barriers(i8* %ptr) {
16 ; CHECK-NOT: store i8 42
18 ; CHECK: %ptr2 = call i8* @llvm.launder.invariant.group.p0i8(i8* %ptr)
19 %ptr2 = call i8* @llvm.launder.invariant.group.p0i8(i8* %ptr)
20 ; CHECK-NOT: store i8 43
21 store i8 43, i8* %ptr2
22 %ptr3 = call i8* @llvm.launder.invariant.group.p0i8(i8* %ptr2)
23 %ptr4 = call i8* @llvm.launder.invariant.group.p0i8(i8* %ptr3)
26 store i8 44, i8* %ptr4
30 ; CHECK-LABEL: void @skip3Barriers(i8* %ptr)
31 define void @skip3Barriers(i8* %ptr) {
32 ; CHECK-NOT: store i8 42
34 ; CHECK: %ptr2 = call i8* @llvm.strip.invariant.group.p0i8(i8* %ptr)
35 %ptr2 = call i8* @llvm.strip.invariant.group.p0i8(i8* %ptr)
36 ; CHECK-NOT: store i8 43
37 store i8 43, i8* %ptr2
38 %ptr3 = call i8* @llvm.strip.invariant.group.p0i8(i8* %ptr2)
39 %ptr4 = call i8* @llvm.strip.invariant.group.p0i8(i8* %ptr3)
42 store i8 44, i8* %ptr4
46 ; CHECK-LABEL: void @skip4Barriers(i8* %ptr)
47 define void @skip4Barriers(i8* %ptr) {
48 ; CHECK-NOT: store i8 42
50 ; CHECK: %ptr2 = call i8* @llvm.strip.invariant.group.p0i8(i8* %ptr)
51 %ptr2 = call i8* @llvm.strip.invariant.group.p0i8(i8* %ptr)
52 ; CHECK-NOT: store i8 43
53 store i8 43, i8* %ptr2
54 %ptr3 = call i8* @llvm.launder.invariant.group.p0i8(i8* %ptr2)
55 %ptr4 = call i8* @llvm.strip.invariant.group.p0i8(i8* %ptr3)
56 %ptr5 = call i8* @llvm.launder.invariant.group.p0i8(i8* %ptr3)
59 store i8 44, i8* %ptr5
64 declare i8* @llvm.launder.invariant.group.p0i8(i8*)
65 declare i8* @llvm.strip.invariant.group.p0i8(i8*)