File: negative.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (48 lines) | stat: -rw-r--r-- 1,986 bytes parent folder | download | duplicates (5)
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
; RUN: opt -S -passes=loop-reroll   %s | FileCheck %s
target triple = "aarch64--linux-gnu"
@buf = global [16 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A", align 1

define i32 @test1(i32 %len, ptr nocapture readonly %buf) #0 {
entry:
  %cmp.13 = icmp sgt i32 %len, 1
  br i1 %cmp.13, label %while.body.lr.ph, label %while.end

while.body.lr.ph:                                 ; preds = %entry
  br label %while.body

while.body:
;CHECK-LABEL: while.body:
;CHECK-NEXT:    %indvar = phi i32 [ %indvar.next, %while.body ], [ 0, %while.body.lr.ph ]
;CHECK-NEXT:    %sum4.015 = phi i64 [ 0, %while.body.lr.ph ], [ %add, %while.body ]
;CHECK-NOT:     %sub5 = add nsw i32 %len.addr.014, -1
;CHECK-NOT:     %sub5 = add nsw i32 %len.addr.014, -2
;CHECK:    br i1 %exitcond, label %while.cond.while.end_crit_edge, label %while.body

  %sum4.015 = phi i64 [ 0, %while.body.lr.ph ], [ %add4, %while.body ]
  %len.addr.014 = phi i32 [ %len, %while.body.lr.ph ], [ %sub5, %while.body ]
  %idxprom = sext i32 %len.addr.014 to i64
  %arrayidx = getelementptr inbounds i8, ptr %buf, i64 %idxprom
  %0 = load i8, ptr %arrayidx, align 1
  %conv = zext i8 %0 to i64
  %add = add i64 %conv, %sum4.015
  %sub = add nsw i32 %len.addr.014, -1
  %idxprom1 = sext i32 %sub to i64
  %arrayidx2 = getelementptr inbounds i8, ptr %buf, i64 %idxprom1
  %1 = load i8, ptr %arrayidx2, align 1
  %conv3 = zext i8 %1 to i64
  %add4 = add i64 %add, %conv3
  %sub5 = add nsw i32 %len.addr.014, -2
  %cmp = icmp sgt i32 %sub5, 1
  br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge

while.cond.while.end_crit_edge:                   ; preds = %while.body
  %add4.lcssa = phi i64 [ %add4, %while.body ]
  %phitmp = trunc i64 %add4.lcssa to i32
  br label %while.end

while.end:                                        ; preds = %while.cond.while.end_crit_edge, %entry
  %sum4.0.lcssa = phi i32 [ %phitmp, %while.cond.while.end_crit_edge ], [ 0, %entry ]
  ret i32 %sum4.0.lcssa
  unreachable
}