[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / branch-target-layout.c
blob5a0a6a3d18962112db985b80ded5d24b4e117f8c
1 // RUN: %clang_cc1 %s -O3 -emit-llvm -o - | FileCheck %s
2 //
3 // PR13214
4 // No assumption may be made about the order that a frontend emits branch
5 // targets (basic blocks). However, the backend's basic block layout makes an
6 // attempt to preserve source order of control flow, and any bias toward source
7 // order must start with the frontend.
8 //
9 // Note that the frontend inverts branches to simplify the condition, so the
10 // order of a branch instruction's labels cannot be used as a source order bias.
12 void calla(void);
13 void callb(void);
14 void callc(void);
16 // CHECK: @test1
17 // CHECK: @calla
18 // CHECK: @callb
19 // CHECK: @callc
20 // CHECK: ret void
21 void test1(int a) {
22 if (a)
23 calla();
24 else
25 callb();
26 callc();
29 // CHECK: @test2
30 // CHECK: @callb
31 // CHECK: @calla
32 // CHECK: @callc
33 // CHECK: ret void
34 void test2(int a) {
35 if (!a)
36 callb();
37 else
38 calla();
39 callc();