File: loop-phi.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (41 lines) | stat: -rw-r--r-- 1,526 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
; RUN: opt < %s -jump-threading -S -jump-threading-across-loop-headers | FileCheck %s

; Make sure we correctly distinguish between %tmp15 and %tmp16 when we clone
; body2.

; CHECK:      body2.thread:
; CHECK-NEXT: %tmp163 = add i32 %tmp165, 1
; CHECK-NEXT: br label %latch1

; CHECK:      latch1:
; CHECK-NEXT: %tmp165 = phi i32 [ %tmp163, %body2.thread ], [ %tmp16, %body2 ]
; CHECK-NEXT: %tmp154 = phi i32 [ %tmp165, %body2.thread ], [ %tmp15, %body2 ]

define i32 @test(i1 %ARG1, i1 %ARG2, i32 %n) {
entry:
  br label %head1

head1:                                            ; preds = %entry, %body1
  %tmp = phi i32 [ 0, %entry ], [ %tmp16, %body1 ]
  %tmp3 = phi i32 [ 0, %entry ], [ %tmp16, %body1 ]
  %tmp4 = phi i32 [ 0, %entry ], [ %tmp16, %body1 ]
  br i1 %ARG1, label %exit, label %body2

body1:                                            ; preds = %latch1
  %tmp12 = icmp sgt i32 %tmp16, 1
  br i1 %tmp12, label %body2, label %head1

body2:                                            ; preds = %head1, %body1
  %tmp14 = phi i32 [ %tmp16, %body1 ], [ %tmp, %head1 ]
  %tmp15 = phi i32 [ %tmp16, %body1 ], [ %tmp3, %head1 ]
  %tmp16 = add i32 %tmp14, 1
  br i1 %ARG2, label %exit, label %latch1

latch1:                                           ; preds = %body2
  %tmp18 = icmp sgt i32 %tmp16, %n
  br i1 %tmp18, label %exit, label %body1

exit:                                             ; preds = %latch1, %body2, %head1
  %rc = phi i32 [ %tmp15, %body2 ], [ %tmp15, %latch1 ], [ -1, %head1 ]
  ret i32 %rc
}