1 ; Test to make sure llvm.invariant.start calls are not treated as clobbers.
2 ; RUN: opt < %s -newgvn -S | FileCheck %s
5 declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly
6 declare void @llvm.invariant.end.p0i8({}*, i64, i8* nocapture) nounwind
8 ; We forward store to the load across the invariant.start intrinsic
9 define i8 @forward_store() {
10 ; CHECK-LABEL: @forward_store
11 ; CHECK: call {}* @llvm.invariant.start.p0i8(i64 1, i8* %a)
16 %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %a)
21 declare i8 @dummy(i8* nocapture) nounwind readonly
23 ; We forward store to the load in the non-local analysis case,
24 ; i.e. invariant.start is in another basic block.
25 define i8 @forward_store_nonlocal(i1 %cond) {
26 ; CHECK-LABEL: forward_store_nonlocal
27 ; CHECK: call {}* @llvm.invariant.start.p0i8(i64 1, i8* %a)
32 %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %a)
33 br i1 %cond, label %loadblock, label %exit
40 %val = call i8 @dummy(i8* %a)
44 ; We should not value forward %foo to the invariant.end corresponding to %bar.
45 define i8 @forward_store1() {
46 ; CHECK-LABEL: forward_store1
47 ; CHECK: %foo = call {}* @llvm.invariant.start.p0i8
49 ; CHECK: %bar = call {}* @llvm.invariant.start.p0i8
50 ; CHECK: call void @llvm.invariant.end.p0i8({}* %bar, i64 1, i8* %a)
54 %foo = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %a)
56 %bar = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %a)
57 call void @llvm.invariant.end.p0i8({}* %bar, i64 1, i8* %a)