File: 2011-03-09-ExactNoMaxBECount.ll

package info (click to toggle)
llvm-toolchain-7 1%3A7.0.1-8%2Bdeb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 734,616 kB
  • sloc: cpp: 3,776,926; ansic: 633,271; asm: 350,301; python: 142,716; objc: 107,612; sh: 22,626; lisp: 11,056; perl: 7,999; pascal: 6,742; ml: 5,537; awk: 3,536; makefile: 2,557; cs: 2,027; xml: 841; javascript: 518; ruby: 156
file content (34 lines) | stat: -rw-r--r-- 1,253 bytes parent folder | download | duplicates (24)
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
; RUN: opt -indvars < %s
; PR9424: Attempt to use a SCEVCouldNotCompute object!
; The inner loop computes the Step and Start of the outer loop.
; Call that Vexit. The outer End value is max(2,Vexit), because
; the condition "icmp %4 < 2" does not guard the outer loop.
; SCEV knows that Vexit has range [2,4], so End == Vexit == Start.
; Now we have ExactBECount == 0. However, MinStart == 2 and MaxEnd == 4.
; Since the stride is variable and may wrap, we cannot compute
; MaxBECount. SCEV should override MaxBECount with ExactBECount.

define void @bar() nounwind {
entry:
  %. = select i1 undef, i32 2, i32 1
  br label %"5.preheader"

"4":                                              ; preds = %"5.preheader", %"4"
  %0 = phi i32 [ 0, %"5.preheader" ], [ %1, %"4" ]
  %1 = add nsw i32 %0, 1
  %2 = icmp sgt i32 %., %1
  br i1 %2, label %"4", label %"9"

"9":                                              ; preds = %"4"
  %3 = add i32 %6, 1
  %4 = add i32 %3, %1
  %5 = icmp slt i32 %4, 2
  br i1 %5, label %"5.preheader", label %return

"5.preheader":                                    ; preds = %"9", %entry
  %6 = phi i32 [ 0, %entry ], [ %4, %"9" ]
  br label %"4"

return:                                           ; preds = %"9"
  ret void
}