File: upperbound.ll

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (38 lines) | stat: -rw-r--r-- 1,301 bytes parent folder | download | duplicates (4)
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
; RUN: opt -loop-unroll -S -mtriple arm-none-eabi -mcpu=cortex-m7 %s | FileCheck %s -check-prefix=UNROLL

; This test is meant to check that this loop is unrolled into three iterations.

; UNROLL-LABEL: @test
; UNROLL: load i32, i32*
; UNROLL: load i32, i32*
; UNROLL: load i32, i32*
; UNROLL-NOT: load i32, i32*

define void @test(i32* %x, i32 %n) {
entry:
  %sub = add nsw i32 %n, -1
  %rem = srem i32 %sub, 4
  %cmp7 = icmp sgt i32 %rem, 0
  br i1 %cmp7, label %while.body, label %while.end

while.body:                                       ; preds = %entry, %if.end
  %x.addr.09 = phi i32* [ %incdec.ptr, %if.end ], [ %x, %entry ]
  %n.addr.08 = phi i32 [ %dec, %if.end ], [ %rem, %entry ]
  %0 = load i32, i32* %x.addr.09, align 4
  %cmp1 = icmp slt i32 %0, 10
  br i1 %cmp1, label %if.then, label %if.end

if.then:                                          ; preds = %while.body
  store i32 0, i32* %x.addr.09, align 4
  br label %if.end

if.end:                                           ; preds = %if.then, %while.body
  %incdec.ptr = getelementptr inbounds i32, i32* %x.addr.09, i32 1
  %dec = add nsw i32 %n.addr.08, -1
  %cmp = icmp sgt i32 %dec, 0
  br i1 %cmp, label %while.body, label %while.end

while.end:                                        ; preds = %if.end, %entry
  ret void
}