File: insert-pos-adjust.ll

package info (click to toggle)
intel-graphics-compiler2 2.28.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 792,744 kB
  • sloc: cpp: 5,761,745; ansic: 466,928; lisp: 312,143; python: 114,790; asm: 44,736; pascal: 10,930; sh: 8,033; perl: 7,914; ml: 3,625; awk: 3,523; yacc: 2,747; javascript: 2,667; lex: 1,898; f90: 1,028; cs: 573; xml: 474; makefile: 344; objc: 162
file content (53 lines) | stat: -rw-r--r-- 2,215 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 --typed-pointers -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()