New feature test for something we have done for a long time
[oota-llvm.git] / test / Transforms / SimplifyCFG / branch-fold-test.ll
1 ; This test ensures that the simplifycfg pass continues to constant fold
2 ; terminator instructions.
3
4 ; RUN: if as < %s | opt -simplifycfg | grep br
5 ; RUN: then exit 1
6 ; RUN: else exit 0
7 ; RUN: fi
8
9 int %test(int %A, int %B) {
10 J:
11         %C = add int %A, 12
12         br bool true, label %L, label %K  ; K is dead!
13 L:
14         %D = add int %C, %B
15         ret int %D
16 K:
17         %E = add int %C, %B
18         ret int %E
19 }