• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; 1. Trivial smoke test of compare and branch, with multiple basic
2; blocks.
3; 2. For a conditional branch on a constant boolean value, make sure
4; we don't lower to a cmp instructions with an immediate as the first
5; source operand.
6
7; REQUIRES: allow_dump
8
9; RUN: %p2i -i %s --args -O2 --verbose inst -threads=0 | FileCheck %s
10; RUN: %p2i -i %s --args -Om1 --verbose inst -threads=0 | FileCheck %s
11
12define internal i32 @simple_cond_branch(i32 %foo, i32 %bar) {
13entry:
14  %r1 = icmp eq i32 %foo, %bar
15  br i1 %r1, label %Equal, label %Unequal
16Equal:
17  ret i32 %foo
18Unequal:
19  ret i32 %bar
20; CHECK-LABEL: simple_cond_branch
21; CHECK: br i1 %r1, label %Equal, label %Unequal
22; CHECK: Equal:
23; CHECK:  ret i32 %foo
24; CHECK: Unequal:
25; CHECK:  ret i32 %bar
26}
27
28define internal i32 @test_br_const() {
29__0:
30  br i1 true, label %__1, label %__2
31__1:
32  ret i32 21
33__2:
34  ret i32 43
35}
36; CHECK-LABEL: test_br_const
37; CHECK-NOT: cmp {{[0-9]*}},
38