summaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/fake-use-noreturn.cpp
blob: db7f27735b1d3f2dcb8c6dd0ced94da9b543f864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
//
// Check we can correctly produce fake uses for function-level variables even
// when we have a return in a nested conditional and there is no code at the end
// of the function.

// CHECK-LABEL: define{{.*}}@_Z3fooi
// CHECK:         [[I_FAKE_USE:%[a-zA-Z0-9\.]+]] = load i32, ptr %i.addr
// CHECK:         call void (...) @llvm.fake.use(i32 [[I_FAKE_USE]])
// CHECK-LABEL: define{{.*}}@_ZN1C3barEi
// CHECK:         [[J_FAKE_USE:%[a-zA-Z0-9\.]+]] = load i32, ptr %j.addr
// CHECK:         call void (...) @llvm.fake.use(i32 [[J_FAKE_USE]])

void foo(int i) {
   while (0)
     if (1)
       return;
}

class C {
  void bar(int j);
};

void C::bar(int j) {
  while (0)
    if (1)
      return;
}