30 lines · c
1// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -o - | FileCheck %s --implicit-check-not=llvm.fake.use2// Check that fake use calls are emitted at the correct locations, i.e.3// at the end of lexical blocks and at the end of the function.4 5int glob_i;6char glob_c;7float glob_f;8 9int foo(int i) {10 // CHECK-LABEL: define{{.*}}foo11 if (i < 4) {12 char j = i * 3;13 if (glob_i > 3) {14 float f = glob_f;15 j = f;16 glob_c = j;17 // CHECK: call void (...) @llvm.fake.use(float %18 // CHECK-NEXT: br label %19 }20 glob_i = j;21 // CHECK: call void (...) @llvm.fake.use(i8 %22 // CHECK-NEXT: br label %23 }24 // CHECK: call void (...) @llvm.fake.use(i32 %25 // CHECK-NEXT: ret26 return 4;27}28 29// CHECK: declare void @llvm.fake.use(...)30