File: simplify_add.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 (101 lines) | stat: -rw-r--r-- 4,466 bytes parent folder | download
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; RUN: igc_opt --igc-const-prop -igc-serialize-metadata -S < %s | FileCheck %s
; RUN: igc_opt --igc-const-prop --override-enable-simplify-gep=1 -igc-serialize-metadata -S < %s | FileCheck %s --check-prefix=OVERRIDE
; ------------------------------------------------
; IGCConstProp
; ------------------------------------------------

declare void @use_float(float*)

define spir_kernel void @test_func(i32 addrspace(1)* %d, i32 addrspace(1)* %s) {
; CHECK-LABEL: @test_func(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = load i32, i32 addrspace(1)* [[D:%.*]]
; CHECK-NEXT:    [[TMP1:%.*]] = add i32 4, [[TMP0]]
; CHECK-NEXT:    [[TMP2:%.*]] = add i32 5, [[TMP1]]
; CHECK-NEXT:    [[TMP3:%.*]] = add i32 [[TMP2]], 6
; CHECK-NEXT:    [[TMP4:%.*]] = add i32 15, [[TMP3]]
; CHECK-NEXT:    [[TMP5:%.*]] = load i32, i32 addrspace(1)* [[S:%.*]]
; CHECK-NEXT:    [[TMP6:%.*]] = add i32 [[TMP5]], 7
; CHECK-NEXT:    [[TMP7:%.*]] = add i32 [[TMP1]], [[TMP6]]
; CHECK-NEXT:    [[TMP8:%.*]] = alloca [1024 x float], align 4
; CHECK-NEXT:    [[TMP9:%.*]] = getelementptr inbounds [1024 x float], [1024 x float]* [[TMP8]], i32 0, i32 [[TMP7]]
; CHECK-NEXT:    call void @use_float(float* [[TMP9]])
; CHECK-NEXT:    [[TMP10:%.*]] = getelementptr inbounds [1024 x float], [1024 x float]* [[TMP8]], i32 0, i32 [[TMP4]]
; CHECK-NEXT:    call void @use_float(float* [[TMP10]])
; CHECK-NEXT:    [[TMP11:%.*]] = getelementptr inbounds [1024 x float], [1024 x float]* [[TMP8]], i32 0, i32 3
; CHECK-NEXT:    call void @use_float(float* [[TMP11]])
; CHECK-NEXT:    ret void
;
; OVERRIDE-LABEL: @test_func(
; OVERRIDE-NEXT:  entry:
; OVERRIDE-NEXT:    [[TMP0:%.*]] = load i32, i32 addrspace(1)* [[D:%.*]]
; OVERRIDE-NEXT:    [[TMP1:%.*]] = add i32 1, 2
; OVERRIDE-NEXT:    [[TMP2:%.*]] = add i32 3, 3
; OVERRIDE-NEXT:    [[TMP3:%.*]] = add i32 [[TMP0]], 4
; OVERRIDE-NEXT:    [[TMP4:%.*]] = add i32 4, [[TMP0]]
; OVERRIDE-NEXT:    [[TMP5:%.*]] = add i32 [[TMP0]], 9
; OVERRIDE-NEXT:    [[TMP6:%.*]] = add i32 5, [[TMP3]]
; OVERRIDE-NEXT:    [[TMP7:%.*]] = add i32 6, 9
; OVERRIDE-NEXT:    [[TMP8:%.*]] = add i32 [[TMP0]], 15
; OVERRIDE-NEXT:    [[TMP9:%.*]] = add i32 [[TMP5]], 6
; OVERRIDE-NEXT:    [[TMP10:%.*]] = add i32 [[TMP0]], 30
; OVERRIDE-NEXT:    [[TMP11:%.*]] = add i32 15, [[TMP8]]
; OVERRIDE-NEXT:    [[TMP12:%.*]] = load i32, i32 addrspace(1)* [[S:%.*]]
; OVERRIDE-NEXT:    [[TMP13:%.*]] = add i32 [[TMP12]], 7
; OVERRIDE-NEXT:    [[TMP14:%.*]] = add i32 [[TMP0]], [[TMP12]]
; OVERRIDE-NEXT:    [[TMP15:%.*]] = add i32 [[TMP14]], 11
; OVERRIDE-NEXT:    [[TMP16:%.*]] = add i32 [[TMP3]], [[TMP13]]
; OVERRIDE-NEXT:    [[TMP17:%.*]] = alloca [1024 x float], align 4
; OVERRIDE-NEXT:    [[TMP18:%.*]] = getelementptr inbounds [1024 x float], [1024 x float]* [[TMP17]], i32 0, i32 [[TMP15]]
; OVERRIDE-NEXT:    call void @use_float(float* [[TMP18]])
; OVERRIDE-NEXT:    [[TMP19:%.*]] = getelementptr inbounds [1024 x float], [1024 x float]* [[TMP17]], i32 0, i32 [[TMP10]]
; OVERRIDE-NEXT:    call void @use_float(float* [[TMP19]])
; OVERRIDE-NEXT:    [[TMP20:%.*]] = getelementptr inbounds [1024 x float], [1024 x float]* [[TMP17]], i32 0, i32 3
; OVERRIDE-NEXT:    call void @use_float(float* [[TMP20]])
; OVERRIDE-NEXT:    ret void
;
entry:
  %0 = load i32, i32 addrspace(1)* %d
  %1 = add i32 1, 2
  %2 = add i32 %1, 3
  %3 = add i32 4, %0
  %4 = add i32 5, %3
  %5 = add i32 %2, 9
  %6 = add i32 %4, 6
  %7 = add i32 %5, %6
  %8 = load i32, i32 addrspace(1)* %s
  %9 = add i32 %8, 7
  %10 = add i32 %3, %9

  %11 = alloca[1024 x float], align 4

  %12 = getelementptr inbounds [1024 x float], [1024 x float]* %11, i32 0, i32 %10
  call void @use_float(float* %12)

  %13 = getelementptr inbounds [1024 x float], [1024 x float]* %11, i32 0, i32 %7
  call void @use_float(float* %13)

  %14 = getelementptr inbounds [1024 x float], [1024 x float]* %11, i32 0, i32 %1
  call void @use_float(float* %14)

  ret void
}

!IGCMetadata = !{!0}
!igc.functions = !{!4}

!0 = !{!"ModuleMD", !1}
!1 = !{!"FuncMD", !2, !3}
!2 = !{!"FuncMDMap[0]", void (i32 addrspace(1)*, i32 addrspace(1)*)* @test_func}
!3 = !{!"FuncMDValue[0]"}
!4 = !{void (i32 addrspace(1)*, i32 addrspace(1)*)* @test_func, !5}
!5 = !{!6}
!6 = !{!"function_type", i32 0}