1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; Test to make sure llvm.invariant.start calls are not treated as clobbers.
3 ; RUN: opt < %s -basic-aa -dse -S | FileCheck %s
5 declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly
7 ; We could remove either store here. The first store is dead in the
8 ; conventional sense, because there is a later killing store. The second store
9 ; is undefined behavior by the semantics of invariant.start, and as such
11 define void @test(i8 *%p) {
13 ; CHECK-NEXT: store i8 3, i8* [[P:%.*]], align 4
14 ; CHECK-NEXT: ret void
16 store i8 1, i8* %p, align 4
17 %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %p)
18 store i8 3, i8* %p, align 4
22 ; FIXME: We should be able to remove the first store to p, even though p and q
24 define void @test2(i8* %p, i8* %q) {
25 ; CHECK-LABEL: @test2(
26 ; CHECK-NEXT: store i8 1, i8* [[P:%.*]], align 4
27 ; CHECK-NEXT: store i8 2, i8* [[Q:%.*]], align 4
28 ; CHECK-NEXT: [[I:%.*]] = call {}* @llvm.invariant.start.p0i8(i64 1, i8* [[Q]])
29 ; CHECK-NEXT: store i8 3, i8* [[P]], align 4
30 ; CHECK-NEXT: ret void
32 store i8 1, i8* %p, align 4
33 store i8 2, i8* %q, align 4
34 %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %q)
35 store i8 3, i8* %p, align 4