1 //===-- main.cpp ------------------------------------------------*- C++ -*-===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 volatile int x; 10 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] 18 } 19 20 void __attribute__((noinline)) func3() { sink(); /* tail */ } 21 22 void __attribute__((disable_tail_calls, noinline)) func2() { func3(); /* regular */ } 23 24 void __attribute__((noinline)) func1() { func2(); /* tail */ } 25 26 int __attribute__((disable_tail_calls)) main() { 27 func1(); /* regular */ 28 return 0; 29 } 30