1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt < %s -passes='require<globals-aa>,gvn' -S | FileCheck %s
4 ; Ensure we do not hoist the load over the call.
6 @G1 = internal global i32 1
7 @G2 = internal global i32 1
9 define i32 @direct_intrinsic(i1 %c) {
10 ; CHECK-LABEL: define {{[^@]+}}@direct_intrinsic
11 ; CHECK-SAME: (i1 [[C:%.*]]) {
12 ; CHECK-NEXT: br i1 [[C]], label [[INIT:%.*]], label [[CHECK:%.*]]
14 ; CHECK-NEXT: store i32 0, ptr @G1, align 4
15 ; CHECK-NEXT: br label [[CHECK]]
17 ; CHECK-NEXT: call void @llvm.unknown()
18 ; CHECK-NEXT: [[V:%.*]] = load i32, ptr @G1, align 4
19 ; CHECK-NEXT: ret i32 [[V]]
21 br i1 %c, label %init, label %check
26 call void @llvm.unknown()
27 %v = load i32, ptr @G1
31 define i32 @indirect_intrinsic(i1 %c) {
32 ; CHECK-LABEL: define {{[^@]+}}@indirect_intrinsic
33 ; CHECK-SAME: (i1 [[C:%.*]]) {
34 ; CHECK-NEXT: br i1 [[C]], label [[INIT:%.*]], label [[CHECK:%.*]]
36 ; CHECK-NEXT: store i32 0, ptr @G2, align 4
37 ; CHECK-NEXT: br label [[CHECK]]
39 ; CHECK-NEXT: call void @intrinsic_caller()
40 ; CHECK-NEXT: [[V:%.*]] = load i32, ptr @G2, align 4
41 ; CHECK-NEXT: ret i32 [[V]]
43 br i1 %c, label %init, label %check
48 call void @intrinsic_caller()
49 %v = load i32, ptr @G2
53 define fastcc void @intrinsic_caller() {
54 ; CHECK-LABEL: define {{[^@]+}}@intrinsic_caller() {
55 ; CHECK-NEXT: call void @llvm.unknown()
56 ; CHECK-NEXT: ret void
58 call void @llvm.unknown()
62 declare void @llvm.unknown()