File: peel-small-loop.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (36 lines) | stat: -rw-r--r-- 1,269 bytes parent folder | download | duplicates (12)
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
; RUN: opt -passes=loop-unroll -mtriple=hexagon -S < %s | FileCheck %s
; Check that the loop is peeled twice for Hexagon.
; CHECK: while.body.peel
; CHECK: while.body.peel2

%struct.STREAM = type { %union.anon, i32, i32 }
%union.anon = type { ptr }

define void @function(ptr nocapture readonly %b) local_unnamed_addr {
entry:
  %bitPtr3 = getelementptr inbounds %struct.STREAM, ptr %b, i32 0, i32 2
  %0 = load i32, ptr %bitPtr3, align 4
  %cmp11 = icmp ult i32 %0, 32
  br i1 %cmp11, label %while.body.preheader, label %do.end

while.body.preheader:
  %value2 = getelementptr inbounds %struct.STREAM, ptr %b, i32 0, i32 1
  %1 = load i32, ptr %value2, align 4
  %2 = load ptr, ptr %b, align 4
  br label %while.body

while.body:
  %bitPtr.014 = phi i32 [ %add, %while.body ], [ %0, %while.body.preheader ]
  %value.013 = phi i32 [ %shl, %while.body ], [ %1, %while.body.preheader ]
  %ptr.012 = phi ptr [ %incdec.ptr, %while.body ], [ %2, %while.body.preheader ]
  %add = add nuw i32 %bitPtr.014, 8
  %shr = lshr i32 %value.013, 24
  %incdec.ptr = getelementptr inbounds i32, ptr %ptr.012, i32 1
  store i32 %shr, ptr %ptr.012, align 4
  %shl = shl i32 %value.013, 8
  %cmp = icmp ult i32 %add, 17
  br i1 %cmp, label %while.body, label %do.end

do.end:
  ret void
}