File: zicfilp-indirect-branch.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (48 lines) | stat: -rw-r--r-- 1,611 bytes parent folder | download | duplicates (7)
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
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
; RUN: llc -mtriple=riscv64 -stop-after=finalize-isel < %s | FileCheck %s
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zicfilp -stop-after=finalize-isel < %s | FileCheck -check-prefixes=ZICFILP %s

@brind.arr = internal unnamed_addr constant [2 x ptr] [ptr blockaddress(@brind, %5), ptr blockaddress(@brind, %8)], align 8
@x = dso_local global i32 0, align 4

define void @brind(i32 noundef signext %0) {
  ; CHECK-LABEL: name: brind
  ; CHECK:   PseudoBRIND killed [[VAR:%.*]], 0
  ; ZICFILP-LABEL: name: brind
  ; ZICFILP:   PseudoBRINDNonX7 killed [[VAR:%.*]], 0
  %2 = sext i32 %0 to i64
  %3 = getelementptr inbounds [2 x ptr], ptr @brind.arr, i64 0, i64 %2
  %4 = load ptr, ptr %3, align 8
  indirectbr ptr %4, [label %5, label %8]

5:                                                ; preds = %1
  %6 = load i32, ptr @x, align 4
  %7 = add nsw i32 %6, 2
  store i32 %7, ptr @x, align 4
  br label %8

8:                                                ; preds = %5, %1
  %9 = load i32, ptr @x, align 4
  %10 = add nsw i32 %9, 1
  store i32 %10, ptr @x, align 4
  ret void
}

define i32 @indirect_call(ptr %0) {
  ; CHECK-LABEL: name: indirect_call
  ; CHECK: PseudoCALLIndirect
  ; ZICFILP-LABEL: name: indirect_call
  ; ZICFILP: PseudoCALLIndirectNonX7
  call void %0()
  ret i32 0
}


define void @indirect_tail(ptr %0) {
  ; CHECK-LABEL: name: indirect_tail
  ; CHECK: PseudoTAILIndirect
  ; ZICFILP-LABEL: name: indirect_tail
  ; ZICFILP: PseudoTAILIndirectNonX7
  tail call void %0()
  ret void
}