File: cgscc-cycle-debug.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 (45 lines) | stat: -rw-r--r-- 1,967 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
41
42
43
44
45
; When an SCC got split due to inlining, we have two mechanisms for reprocessing the updated SCC, first is UR.UpdatedC
; that repeatedly rerun the new, current SCC; second is a worklist for all newly split SCCs. We need to avoid rerun of
; the same SCC when the SCC is set to be processed by both mechanisms back to back. In pathological cases, such extra,
; redundant rerun could cause exponential size growth due to inlining along cycles.
;
; The test cases here illustrates potential redundant rerun and how it's prevented, however there's no extra inlining
; even if we allow the redundant rerun. In real code, when inliner makes different decisions for different call sites
; of the same caller-callee edge, we could end up getting more recursive inlining without SCC mutation.
;
; REQUIRES: asserts
; RUN: opt < %s -passes='cgscc(inline)' -inline-threshold=500 -debug-only=cgscc -S 2>&1 | FileCheck %s

; CHECK: Running an SCC pass across the RefSCC: [(test1_a, test1_b, test1_c)]
; CHECK: Enqueuing the existing SCC in the worklist:(test1_b)
; CHECK: Enqueuing a newly formed SCC:(test1_c)
; CHECK: Enqueuing a new RefSCC in the update worklist: [(test1_b)]
; CHECK: Switch an internal ref edge to a call edge from 'test1_a' to 'test1_c'
; CHECK: Switch an internal ref edge to a call edge from 'test1_a' to 'test1_a'
; CHECK: Re-running SCC passes after a refinement of the current SCC: (test1_c, test1_a)
; CHECK: Skipping redundant run on SCC: (test1_c, test1_a)
; CHECK: Skipping an SCC that is now part of some other RefSCC...

declare void @external(i32 %seed)

define void @test1_a(i32 %num) {
entry:
  call void @test1_b(i32 %num)
  call void @external(i32 %num)
  ret void
}

define void @test1_b(i32 %num) {
entry:
  call void @test1_c(i32 %num)
  call void @test1_a(i32 %num)
  call void @external(i32 %num)
  ret void
}

define void @test1_c(i32 %num) #0 {
  call void @test1_a(i32 %num)
  ret void
}

attributes #0 = { noinline nounwind optnone }