xref: /llvm-project/clang/test/CodeGen/extend-variable-liveness.c (revision de9b0ddedc43302117b15518ca21f3341cf6b5ff)
1 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -o - | FileCheck %s --implicit-check-not=llvm.fake.use
2 // 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 
5 int glob_i;
6 char glob_c;
7 float glob_f;
8 
9 int foo(int i) {
10   // CHECK-LABEL: define{{.*}}foo
11   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: ret
26   return 4;
27 }
28 
29 // CHECK: declare void @llvm.fake.use(...)
30