41 lines · c
1// RUN: %clang_cc1 %s -O3 -emit-llvm -o - | FileCheck %s2//3// PR132144// No assumption may be made about the order that a frontend emits branch5// targets (basic blocks). However, the backend's basic block layout makes an6// attempt to preserve source order of control flow, and any bias toward source7// order must start with the frontend.8//9// Note that the frontend inverts branches to simplify the condition, so the10// order of a branch instruction's labels cannot be used as a source order bias.11 12void calla(void);13void callb(void);14void callc(void);15 16// CHECK: @test117// CHECK: @calla18// CHECK: @callb19// CHECK: @callc20// CHECK: ret void21void test1(int a) {22 if (a)23 calla();24 else25 callb();26 callc();27}28 29// CHECK: @test230// CHECK: @callb31// CHECK: @calla32// CHECK: @callc33// CHECK: ret void34void test2(int a) {35 if (!a)36 callb();37 else38 calla();39 callc();40}41