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)) sink2() {
12 x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=FROM-FUNC1")
13 // FROM-FUNC1: frame #0: 0x{{[0-9a-f]+}} a.out`sink{{.*}} at main.cpp:[[@LINE-1]]:{{.*}} [opt]
14 // FROM-FUNC1-NEXT: sink({{.*}} [opt]
15 // FROM-FUNC1-NEXT: func1{{.*}} [opt] [artificial]
16 // FROM-FUNC1-NEXT: main{{.*}} [opt]
19 void __attribute__((noinline)) sink(bool called_from_main) {
20 if (called_from_main) {
21 x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=FROM-MAIN")
22 // FROM-MAIN: frame #0: 0x{{[0-9a-f]+}} a.out`sink{{.*}} at main.cpp:[[@LINE-1]]:{{.*}} [opt]
23 // FROM-MAIN-NEXT: main{{.*}} [opt]
29 void __attribute__((noinline)) func1() { sink(false); /* tail */ }
31 int __attribute__((disable_tail_calls)) main(int argc, char **) {
32 // When func1 tail-calls sink, make sure that the former appears in the