File: BlockAddressReference.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (36 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download | duplicates (7)
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 < %s -loop-simplify -loop-extract -S | FileCheck %s

@label = common local_unnamed_addr global i8* null

; CHECK: define
; no outlined function
; CHECK-NOT: define
define i32 @sterix(i32 %n) {
entry:
  %tobool = icmp ne i32 %n, 0
  ; this blockaddress references a basic block that goes in the extracted loop
  %cond = select i1 %tobool, i8* blockaddress(@sterix, %for.cond), i8* blockaddress(@sterix, %exit)
  store i8* %cond, i8** @label
  %cmp5 = icmp sgt i32 %n, 0
  br i1 %cmp5, label %for.body, label %exit

for.cond:
  %mul = shl nsw i32 %s.06, 1
  %exitcond = icmp eq i32 %inc, %n
  br i1 %exitcond, label %exit.loopexit, label %for.body

for.body:
  %i.07 = phi i32 [ %inc, %for.cond ], [ 0, %entry ]
  %s.06 = phi i32 [ %mul, %for.cond ], [ 1, %entry ]
  %inc = add nuw nsw i32 %i.07, 1
  br label %for.cond

exit.loopexit:
  %phitmp = icmp ne i32 %s.06, 2
  %phitmp8 = zext i1 %phitmp to i32
  br label %exit

exit:
  %s.1 = phi i32 [ 1, %entry ], [ %phitmp8, %exit.loopexit ]
  ret i32 %s.1
}