File: epilog_const_phi.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (65 lines) | stat: -rw-r--r-- 2,392 bytes parent folder | download | duplicates (14)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
; RUN: opt -S -passes=loop-unroll -unroll-runtime < %s | FileCheck %s

; Epilog unroll allows to keep PHI constant value.
; For the test this means that after unroll XOR could be deleted.
; Check that we do epilogue reminder here.

; CHECK-LABEL: const_phi_val
; CHECK:  for.body.epil

; Function Attrs: norecurse nounwind uwtable
define void @const_phi_val(i32 %i0, ptr nocapture %a) {
entry:
  %cmp6 = icmp slt i32 %i0, 1000
  br i1 %cmp6, label %for.body.preheader, label %for.end

for.body.preheader:                               ; preds = %entry
  %tmp = sext i32 %i0 to i64
  br label %for.body

for.body:                                         ; preds = %for.body, %for.body.preheader
  %indvars.iv = phi i64 [ %tmp, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %s.08 = phi i32 [ 0, %for.body.preheader ], [ %xor, %for.body ]
  %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
  store i32 %s.08, ptr %arrayidx, align 4
  %xor = xor i32 %s.08, 1
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, 1000
  br i1 %exitcond, label %for.end.loopexit, label %for.body

for.end.loopexit:                                 ; preds = %for.body
  br label %for.end

for.end:                                          ; preds = %for.end.loopexit, %entry
  ret void
}

; When there is no phi with const coming from preheader,
; there is no need to do epilogue unrolling.

; CHECK-LABEL: var_phi_val
; CHECK:  for.body.prol

; Function Attrs: norecurse nounwind uwtable
define void @var_phi_val(i32 %i0, ptr nocapture %a) {
entry:
  %cmp6 = icmp slt i32 %i0, 1000
  br i1 %cmp6, label %for.body.preheader, label %for.end

for.body.preheader:                               ; preds = %entry
  %tmp = sext i32 %i0 to i64
  br label %for.body

for.body:                                         ; preds = %for.body, %for.body.preheader
  %indvars.iv = phi i64 [ %tmp, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, 1000
  br i1 %exitcond, label %for.end.loopexit, label %for.body

for.end.loopexit:                                 ; preds = %for.body
  br label %for.end

for.end:                                          ; preds = %for.end.loopexit, %entry
  ret void
}