diff options
author | Andrew Trick <atrick@apple.com> | 2012-06-26 18:13:12 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-06-26 18:13:12 +0000 |
commit | 18e3dfc5475763a381737fc6e39d88f062e7d69a (patch) | |
tree | f47466d640c55f063a38d4e90e687a38cf6397aa /clang | |
parent | 3563c28ab207e987203316f49d0938f3a4f72a0f (diff) | |
download | bcm5719-llvm-18e3dfc5475763a381737fc6e39d88f062e7d69a.tar.gz bcm5719-llvm-18e3dfc5475763a381737fc6e39d88f062e7d69a.zip |
MachineBlockPlacement would prefer that clang lay out blocks in source order.
llvm-svn: 159215
Diffstat (limited to 'clang')
-rw-r--r-- | clang/test/CodeGen/branch-target-layout.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/clang/test/CodeGen/branch-target-layout.c b/clang/test/CodeGen/branch-target-layout.c new file mode 100644 index 00000000000..b93a0c7a4bc --- /dev/null +++ b/clang/test/CodeGen/branch-target-layout.c @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 %s -O3 -emit-llvm -o - | FileCheck %s +// +// PR13214 +// No assumption may be made about the order that a frontend emits branch +// targets (basic blocks). However, the backend's basic block layout makes an +// attempt to preserve source order of control flow, and any bias toward source +// order must start with the frontend. +// +// Note that the frontend inverts branches to simplify the condition, so the +// order of a branch instruction's labels cannot be used as a source order bias. + +void calla(); +void callb(); +void callc(); + +// CHECK: @test +// CHECK: @calla() +// CHECK: @callb() +// CHECK: @callc() +// CHECK: ret void +void test1(int a) { + if (a) + calla(); + else + callb(); + callc(); +} + +// CHECK: @test +// CHECK: @callb() +// CHECK: @calla() +// CHECK: @callc() +// CHECK: ret void +void test2(int a) { + if (!a) + callb(); + else + calla(); + callc(); +} |