• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test reading phi instructions.
2
3; RUN: %p2i -i %s --insts | FileCheck %s
4; RUN:   %p2i -i %s --args -notranslate -timing | \
5; RUN:   FileCheck --check-prefix=NOIR %s
6
7; TODO(kschimpf) Add forward reference examples.
8
9define internal i32 @testPhi1(i32 %arg) {
10entry:
11  %cmp1 = icmp sgt i32 %arg, 0
12  br i1 %cmp1, label %next, label %target
13next:
14  br label %target
15target:
16  %merge = phi i1 [ %cmp1, %entry ], [ false, %next ]
17  %result = zext i1 %merge to i32
18  ret i32 %result
19}
20
21; CHECK:      define internal i32 @testPhi1(i32 %arg) {
22; CHECK-NEXT: entry:
23; CHECK-NEXT:   %cmp1 = icmp sgt i32 %arg, 0
24; CHECK-NEXT:   br i1 %cmp1, label %next, label %target
25; CHECK-NEXT: next:
26; CHECK-NEXT:   br label %target
27; CHECK-NEXT: target:
28; CHECK-NEXT:   %merge = phi i1 [ %cmp1, %entry ], [ false, %next ]
29; CHECK-NEXT:   %result = zext i1 %merge to i32
30; CHECK-NEXT:   ret i32 %result
31; CHECK-NEXT: }
32
33; NOIR: Total across all functions
34