File: loopsink-pr39695.ll

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,418,840 kB
  • sloc: cpp: 5,290,826; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,898; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,913; xml: 953; cs: 573; fortran: 539
file content (40 lines) | stat: -rw-r--r-- 1,475 bytes parent folder | download | duplicates (6)
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
; RUN: opt -S -loop-sink < %s | FileCheck %s
; RUN: opt -S -verify-memoryssa -enable-mssa-in-legacy-loop-sink -loop-sink < %s | FileCheck %s
; RUN: opt -S -aa-pipeline=basic-aa -passes=loop-sink < %s | FileCheck %s
; RUN: opt -S -verify-memoryssa -enable-mssa-in-loop-sink -aa-pipeline=basic-aa -passes=loop-sink < %s | FileCheck %s

; The load instruction should not be sunk into following loop.
; CHECK:      @foo
; CHECK-NEXT: entry
; CHECK-NEXT: %ptr = load i8*, i8** %pp, align 8
; CHECK-NEXT: store i8* null, i8** %pp, align 8

define i32 @foo(i32 %n, i8** %pp) !prof !0 {
entry:
  %ptr = load i8*, i8** %pp, align 8
  store i8* null, i8** %pp, align 8
  br label %for.cond

for.cond:                                         ; preds = %for.body, %entry
  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
  %cmp = icmp ult i32 %i.0, %n
  br i1 %cmp, label %for.body, label %for.end, !prof !1

for.body:                                         ; preds = %for.cond
  %0 = sext i32 %i.0 to i64
  %arrayidx = getelementptr inbounds i8, i8* %ptr, i64 %0
  %1 = load i8, i8* %arrayidx, align 1
  %or19 = call i8 @llvm.bitreverse.i8(i8 %1)
  %v = sext i8 %or19 to i32
  %inc = add i32 %i.0, %v
  br label %for.cond

for.end:                                          ; preds = %for.cond
  ret i32 %i.0
}

declare i8 @llvm.bitreverse.i8(i8) #0
attributes #0 = { nounwind readnone speculatable }

!0 = !{!"function_entry_count", i64 1}
!1 = !{!"branch_weights", i32 1, i32 2000}