File: FullUnroll.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 (77 lines) | stat: -rw-r--r-- 2,592 bytes parent folder | download | duplicates (2)
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
66
67
68
69
70
71
72
73
74
75
76
77
; RUN: opt -passes='default<O1>' -disable-verify --mtriple x86_64-pc-linux-gnu -disable-loop-unrolling=true \
; RUN: -S -o - %s | FileCheck %s

; This checks that the loop full unroller will fire in the new pass manager
; when forced via #pragma in the source (or annotation in the code).
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; We don't end up deleting the loop, merely turning it infinite, but we remove
; everything inside of it so check for the loop structure and absence of
; conditional branches.
; CHECK-LABEL: bb
; CHECK: br label
; CHECK-NOT: br i1
; CHECK: br label
; CHECK-NOT: br i1

; Function Attrs: noinline nounwind optnone uwtable
define void @foo() #0 {
bb:
  %tmp = alloca [5 x i32*], align 16
  %tmp1 = alloca i32, align 4
  %tmp2 = alloca i32, align 4
  store i32 5, i32* %tmp1, align 4
  br label %bb3

bb3:                                              ; preds = %bb23, %bb
  %tmp4 = load i32, i32* %tmp1, align 4
  %tmp5 = icmp ne i32 %tmp4, 0
  br i1 %tmp5, label %bb6, label %bb24

bb6:                                              ; preds = %bb3
  store i32 0, i32* %tmp2, align 4
  br label %bb7

bb7:                                              ; preds = %bb20, %bb6
  %tmp8 = load i32, i32* %tmp2, align 4
  %tmp9 = icmp slt i32 %tmp8, 5
  br i1 %tmp9, label %bb10, label %bb23

bb10:                                             ; preds = %bb7
  %tmp11 = load i32, i32* %tmp2, align 4
  %tmp12 = sext i32 %tmp11 to i64
  %tmp13 = getelementptr inbounds [5 x i32*], [5 x i32*]* %tmp, i64 0, i64 %tmp12
  %tmp14 = load i32*, i32** %tmp13, align 8
  %tmp15 = icmp ne i32* %tmp14, null
  br i1 %tmp15, label %bb16, label %bb19

bb16:                                             ; preds = %bb10
  %tmp17 = load i32, i32* %tmp1, align 4
  %tmp18 = add nsw i32 %tmp17, -1
  store i32 %tmp18, i32* %tmp1, align 4
  br label %bb19

bb19:                                             ; preds = %bb16, %bb10
  br label %bb20

bb20:                                             ; preds = %bb19
  %tmp21 = load i32, i32* %tmp2, align 4
  %tmp22 = add nsw i32 %tmp21, 1
  store i32 %tmp22, i32* %tmp2, align 4
  br label %bb7, !llvm.loop !1

bb23:                                             ; preds = %bb7
  br label %bb3

bb24:                                             ; preds = %bb3
  ret void
}

attributes #0 = { noinline nounwind optnone uwtable }

!llvm.module.flags = !{!0}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = distinct !{!1, !2}
!2 = !{!"llvm.loop.unroll.full"}