1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 void __attribute__((noinline)) sink() {
12 x++; //% self.filecheck("bt", "main.cpp", "-implicit-check-not=artificial")
13 // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4 [opt]
14 // CHECK-NEXT: frame #1: 0x{{[0-9a-f]+}} a.out`func3{{.*}} [opt] [artificial]
15 // CHECK-NEXT: frame #2: 0x{{[0-9a-f]+}} a.out`func2{{.*}} [opt]
16 // CHECK-NEXT: frame #3: 0x{{[0-9a-f]+}} a.out`func1{{.*}} [opt] [artificial]
17 // CHECK-NEXT: frame #4: 0x{{[0-9a-f]+}} a.out`main{{.*}} [opt]
20 void __attribute__((noinline)) func3() { sink(); /* tail */ }
22 void __attribute__((disable_tail_calls, noinline)) func2() { func3(); /* regular */ }
24 void __attribute__((noinline)) func1() { func2(); /* tail */ }
26 int __attribute__((disable_tail_calls)) main() {
27 func1(); /* regular */