File: insert-pos-adjust.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 (53 lines) | stat: -rw-r--r-- 2,198 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
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2023 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
; REQUIRES: regkeys
; RUN: igc_opt -igc-hoist-congruent-phi -inputcs --regkey CodeSinkingMinSize=10 -S < %s | FileCheck %s
; ------------------------------------------------
; CodeSinking
; ------------------------------------------------
; Check that instructions are hoisted before their uses
;

define float @test(i1 %cond) {
; CHECK-LABEL: entry:
; %loadB and %subB must be hoisted before %mulA2
; CHECK-NEXT: [[HOISTEDLOADB:%.*]] = load float, float addrspace(65554)* inttoptr (i32 48 to float addrspace(65554)*), align 16
; CHECK-NEXT: [[HOISTEDSUBB:%.*]] = fsub fast float -0.000000e+00, [[HOISTEDLOADB]]
; next instruction is not a hoisted instruction
; CHECK-NEXT: %mulA2 = fmul fast float [[HOISTEDSUBB]], [[HOISTEDLOADB]]
; %mulA2 is the `leave` instruction for the rest of hoisted instructions
; CHECK-NEXT: [[HOISTEDMULB1:%.*]] = fmul fast float [[HOISTEDSUBB]], [[HOISTEDLOADB]]
; CHECK-NEXT: [[HOISTEDMULB3:%.*]] = fmul fast float [[HOISTEDMULB1]], %mulA2
; CHECK-NEXT: br i1 %cond, label %then, label %exit
entry:
  %loadA = load float, float addrspace(65554)* inttoptr (i32 48 to float addrspace(65554)*), align 16
  %subA = fsub fast float -0.000000e+00, %loadA
  %mulA1 = fmul fast float %subA, %loadA
  %mulA2 = fmul fast float %subA, %loadA
  %mulA3 = fmul fast float %mulA1, %mulA2
  br i1 %cond, label %then, label %exit
; nothing left in the then BB
; CHECK-LABEL: then:
; CHECK-NEXT: br label %exit
then:
  %loadB = load float, float addrspace(65554)* inttoptr (i32 48 to float addrspace(65554)*), align 16
  %subB = fsub fast float -0.000000e+00, %loadB
  %mulB1 = fmul fast float %subB, %loadB
  ; note the use of %mulA2 in the following instruction
  %mulB3 = fmul fast float %mulB1, %mulA2
  br label %exit
; no phi instruction, hoisted %mulB3 is the return value
; CHECK-LABEL: exit:
; CHECK: ret float [[HOISTEDMULB3]]
exit:
  %retVal = phi float [ %mulB3, %then ], [ %mulA3, %entry ]
  ret float %retVal
}

declare void @foo()