File: fli-licm.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (72 lines) | stat: -rw-r--r-- 2,451 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
67
68
69
70
71
72
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; RUN: llc < %s -mtriple=riscv32 -target-abi=ilp32f -mattr=+experimental-zfa \
; RUN:   | FileCheck %s --check-prefix=RV32
; RUN: llc < %s -mtriple=riscv64 -target-abi=lp64f -mattr=+experimental-zfa \
; RUN:   | FileCheck %s --check-prefix=RV64

; The purpose of this test is to check that an FLI instruction that
; materializes an immediate is not MachineLICM'd out of a loop.

%struct.Node = type { ptr, i8* }

define void @process_nodes(ptr %0) nounwind {
; RV32-LABEL: process_nodes:
; RV32:       # %bb.0: # %entry
; RV32-NEXT:    beqz a0, .LBB0_4
; RV32-NEXT:  # %bb.1: # %loop.preheader
; RV32-NEXT:    addi sp, sp, -16
; RV32-NEXT:    sw ra, 12(sp) # 4-byte Folded Spill
; RV32-NEXT:    sw s0, 8(sp) # 4-byte Folded Spill
; RV32-NEXT:    mv s0, a0
; RV32-NEXT:  .LBB0_2: # %loop
; RV32-NEXT:    # =>This Inner Loop Header: Depth=1
; RV32-NEXT:    fli.s fa0, 1.0
; RV32-NEXT:    mv a0, s0
; RV32-NEXT:    call do_it@plt
; RV32-NEXT:    lw s0, 0(s0)
; RV32-NEXT:    bnez s0, .LBB0_2
; RV32-NEXT:  # %bb.3:
; RV32-NEXT:    lw ra, 12(sp) # 4-byte Folded Reload
; RV32-NEXT:    lw s0, 8(sp) # 4-byte Folded Reload
; RV32-NEXT:    addi sp, sp, 16
; RV32-NEXT:  .LBB0_4: # %exit
; RV32-NEXT:    ret
;
; RV64-LABEL: process_nodes:
; RV64:       # %bb.0: # %entry
; RV64-NEXT:    beqz a0, .LBB0_4
; RV64-NEXT:  # %bb.1: # %loop.preheader
; RV64-NEXT:    addi sp, sp, -16
; RV64-NEXT:    sd ra, 8(sp) # 8-byte Folded Spill
; RV64-NEXT:    sd s0, 0(sp) # 8-byte Folded Spill
; RV64-NEXT:    mv s0, a0
; RV64-NEXT:  .LBB0_2: # %loop
; RV64-NEXT:    # =>This Inner Loop Header: Depth=1
; RV64-NEXT:    fli.s fa0, 1.0
; RV64-NEXT:    mv a0, s0
; RV64-NEXT:    call do_it@plt
; RV64-NEXT:    ld s0, 0(s0)
; RV64-NEXT:    bnez s0, .LBB0_2
; RV64-NEXT:  # %bb.3:
; RV64-NEXT:    ld ra, 8(sp) # 8-byte Folded Reload
; RV64-NEXT:    ld s0, 0(sp) # 8-byte Folded Reload
; RV64-NEXT:    addi sp, sp, 16
; RV64-NEXT:  .LBB0_4: # %exit
; RV64-NEXT:    ret
entry:
  %1 = icmp eq ptr %0, null
  br i1 %1, label %exit, label %loop

loop:
  %2 = phi %struct.Node* [ %4, %loop ], [ %0, %entry ]
  tail call void @do_it(float 1.000000e+00, ptr nonnull %2)
  %3 = getelementptr inbounds %struct.Node, ptr %2, i64 0, i32 0
  %4 = load ptr, ptr %3, align 8
  %5 = icmp eq ptr %4, null
  br i1 %5, label %exit, label %loop

exit:
  ret void
}

declare void @do_it(float, ptr)