xref: /llvm-project/clang/test/CodeGen/fake-use-return-line.c (revision 4424c44c8c4ec8e071f5c5999fba216d36fb92c9)
1 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -fextend-variable-liveness -o - %s | FileCheck %s
2 
3 // Clang adjusts the line numbers of returns based on the line numbers of
4 // dominating stores to %retval; we test that fake use intrinsics do not affect
5 // this, and the return is given the correct line.
6 
7 // CHECK: define{{.*}}@main
8 // CHECK: call void (...) @llvm.fake.use(i32
9 // CHECK-NEXT: ret i32{{.*}}!dbg ![[MDINDEX:[0-9]*]]
10 // CHECK: ![[MDINDEX]] = !DILocation(line: [[# @LINE + 5]]
11 int main()
12 {
13   volatile int a = 1;
14   int b = a + 2;
15   return b;
16 }
17