File: 2012-04-09-unroll-indirectbr.ll

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (40 lines) | stat: -rw-r--r-- 1,633 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
37
38
39
40
; RUN: opt < %s -S -loop-unroll -simplifycfg -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s
; PR12513: Loop unrolling breaks with indirect branches.
; If loop unrolling attempts to transform this loop, it replaces the
; indirectbr successors. SimplifyCFG then considers them to be unreachable.
declare void @subtract() nounwind uwtable

; CHECK-NOT: unreachable
define i32 @main(i32 %argc, i8** nocapture %argv) nounwind uwtable {
entry:
  %vals19 = alloca [5 x i32], align 16
  %x20 = alloca i32, align 4
  store i32 135, i32* %x20, align 4
  br label %for.body

for.body:                                         ; preds = ; %call2_termjoin, %call3_termjoin
  %indvars.iv = phi i64 [ 0, %entry ], [ %joinphi15.in.in, %call2_termjoin ]
  %a6 = call coldcc i8* @funca(i8* blockaddress(@main, %for.body_code), i8*
blockaddress(@main, %for.body_codeprime)) nounwind
  indirectbr i8* %a6, [label %for.body_code, label %for.body_codeprime]

for.body_code:                                    ; preds = %for.body
  call void @subtract()
  br label %call2_termjoin

call2_termjoin:                                   ; preds = %for.body_codeprime, %for.body_code
  %joinphi15.in.in = add i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %joinphi15.in.in, 5
  br i1 %exitcond, label %for.end, label %for.body

for.end:                                          ; preds = %call2_termjoin
  ret i32 0

for.body_codeprime:                               ; preds = %for.body
  call void @subtract_v2(i64 %indvars.iv)
  br label %call2_termjoin
}

declare coldcc i8* @funca(i8*, i8*) readonly

declare void @subtract_v2(i64) nounwind uwtable