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