xref: /llvm-project/clang/test/CodeGen/fake-use-noreturn.cpp (revision de9b0ddedc43302117b15518ca21f3341cf6b5ff)
1 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
2 //
3 // Check we can correctly produce fake uses for function-level variables even
4 // when we have a return in a nested conditional and there is no code at the end
5 // of the function.
6 
7 // CHECK-LABEL: define{{.*}}@_Z3fooi
8 // CHECK:         [[I_FAKE_USE:%[a-zA-Z0-9\.]+]] = load i32, ptr %i.addr
9 // CHECK:         call void (...) @llvm.fake.use(i32 [[I_FAKE_USE]])
10 // CHECK-LABEL: define{{.*}}@_ZN1C3barEi
11 // CHECK:         [[J_FAKE_USE:%[a-zA-Z0-9\.]+]] = load i32, ptr %j.addr
12 // CHECK:         call void (...) @llvm.fake.use(i32 [[J_FAKE_USE]])
13 
14 void foo(int i) {
15    while (0)
16      if (1)
17        return;
18 }
19 
20 class C {
21   void bar(int j);
22 };
23 
24 void C::bar(int j) {
25   while (0)
26     if (1)
27       return;
28 }
29