File: recursion.ll

package info (click to toggle)
intel-graphics-compiler 1.0.17791.18-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 102,312 kB
  • sloc: cpp: 935,343; lisp: 286,143; ansic: 16,196; python: 3,279; yacc: 2,487; lex: 1,642; pascal: 300; sh: 174; makefile: 27
file content (66 lines) | stat: -rw-r--r-- 2,019 bytes parent folder | download | duplicates (2)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022-2024 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
; REQUIRES: llvm-14-plus, regkeys
; RUN: igc_opt --opaque-pointers -regkey PrintFunctionSizeAnalysis=1  --EstimateFunctionSize -S < %s 2>&1 | FileCheck %s
; ------------------------------------------------
; EstimateFunctionSize
; ------------------------------------------------

; CHECK: Unit size (kernel entry) test_estimate: 16
; CHECK: Function count= 2
; CHECK: Kernel count= 1
; CHECK: Manual stack call count= 0
; CHECK: Address taken function call count= 0

; Fix - debug counts for head size

define spir_kernel void @test_estimate(i32* %s) {
entry:
  %0 = alloca i32, align 4
  %1 = call spir_func i32 @foo(i32* %s)
  br label %end

end:                                              ; preds = %entry
  %2 = call spir_func i32 @__builtin_spirv_BuiltInSubgroupId()
  %3 = add i32 %2, %1
  store i32 %3, i32* %0, align 4
  ret void
}

define spir_func i32 @foo(i32* %a) {
entry:
  %0 = load i32, i32* %a, align 4
  %1 = ptrtoint i32* %a to i32
  %2 = icmp slt i32 %0, %1
  br i1 %2, label %end, label %continue

continue:                                         ; preds = %entry
  %3 = inttoptr i32 %0 to i32*
  %4 = call spir_func i32 @foo(i32* %3)
  br label %end

end:                                              ; preds = %continue, %entry
  %5 = phi i32 [ %1, %entry ], [ %4, %continue ]
  ret i32 %5
}

declare spir_func i32 @__builtin_spirv_BuiltInSubgroupId()

; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare void @llvm.dbg.value(metadata, metadata, metadata) #0

attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }

!igc.functions = !{!0, !3}
!0 = !{void (i32*)* @test_estimate, !1}
!1 = !{!2}
!2 = !{!"function_type", i32 0}
!3 = !{i32 (i32*)* @foo, !4}
!4 = !{!5}
!5 = !{!"function_type", i32 2}