1 ; Test to make sure llvm.invariant.start calls are not treated as clobbers.
2 ; RUN: opt < %s -basicaa -dse -S | FileCheck %s
4 declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly
6 ; We cannot remove the store 1 to %p.
7 ; FIXME: By the semantics of invariant.start, the store 3 to p is unreachable.
8 define void @test(i8 *%p) {
9 store i8 1, i8* %p, align 4
10 %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %p)
11 store i8 3, i8* %p, align 4
14 ; CHECK-NEXT: store i8 1, i8* %p, align 4
15 ; CHECK-NEXT: %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %p)
16 ; CHECK-NEXT: store i8 3, i8* %p, align 4
17 ; CHECK-NEXT: ret void
20 ; FIXME: We should be able to remove the first store to p, even though p and q
22 define void @test2(i8* %p, i8* %q) {
23 store i8 1, i8* %p, align 4
24 store i8 2, i8* %q, align 4
25 %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %q)
26 store i8 3, i8* %p, align 4
28 ; CHECK-LABEL: @test2(
29 ; CHECK-NEXT: store i8 1, i8* %p, align 4
30 ; CHECK-NEXT: store i8 2, i8* %q, align 4
31 ; CHECK-NEXT: %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %q)
32 ; CHECK-NEXT: store i8 3, i8* %p, align 4
33 ; CHECK-NEXT: ret void