File: range-signedness.ll

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (39 lines) | stat: -rw-r--r-- 882 bytes parent folder | download | duplicates (15)
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
; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s

define void @x(i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @x
 entry:
  br label %loop

 loop:
  %idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ]
; CHECK: %idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ]
; CHECK-NEXT:  -->  {0,+,1}<nuw><nsw><%loop> U: [0,-128) S: [0,-128)

  %idx.inc = add nsw i8 %idx, 1

  %c = load volatile i1, i1* %cond
  br i1 %c, label %loop, label %exit

 exit:
  ret void
}

define void @y(i8* %addr) {
; CHECK-LABEL: Classifying expressions for: @y
 entry:
  br label %loop

 loop:
  %idx = phi i8 [-5, %entry ], [ %idx.inc, %loop ]
; CHECK:   %idx = phi i8 [ -5, %entry ], [ %idx.inc, %loop ]
; CHECK-NEXT:  -->  {-5,+,1}<%loop> U: [-5,6) S: [-5,6)

  %idx.inc = add i8 %idx, 1

  %continue = icmp slt i8 %idx.inc, 6
  br i1 %continue, label %loop, label %exit

 exit:
  ret void
}