File: promote-call-bitwidth.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (48 lines) | stat: -rw-r--r-- 2,063 bytes parent folder | download | duplicates (6)
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_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
; RUN: opt -S -passes=inline < %s | FileCheck %s

;; Check that we correctly use the index size when accumulating offsets during CallPromotion

target datalayout = "p200:128:128:128:64-A200-P200-G200"

define void @test(ptr addrspace(200) %arg1, ptr addrspace(200) %arg2) local_unnamed_addr addrspace(200) {
; CHECK-LABEL: define {{[^@]+}}@test
; CHECK-SAME: (ptr addrspace(200) [[ARG1:%.*]], ptr addrspace(200) [[ARG2:%.*]]) local_unnamed_addr addrspace(200) {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = load ptr addrspace(200), ptr addrspace(200) [[ARG2]], align 16
; CHECK-NEXT:    call addrspace(200) void [[TMP0]](ptr addrspace(200) [[ARG1]])
; CHECK-NEXT:    ret void
;
entry:
  call void @call_fnptr(ptr addrspace(200) %arg1, ptr addrspace(200) %arg2)
  ret void
}

define internal void @call_fnptr(ptr addrspace(200) %this, ptr addrspace(200) %arg) unnamed_addr addrspace(200) align 2 {
entry:
  %0 = load ptr addrspace(200), ptr addrspace(200) %arg, align 16
  call void %0(ptr addrspace(200) %this)
  ret void
}

define void @test2(ptr addrspace(200) %this) local_unnamed_addr addrspace(200) {
; CHECK-LABEL: define {{[^@]+}}@test2
; CHECK-SAME: (ptr addrspace(200) [[THIS:%.*]]) local_unnamed_addr addrspace(200) {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[VTABLE_I:%.*]] = load ptr addrspace(200), ptr addrspace(200) [[THIS]], align 16
; CHECK-NEXT:    [[FN_I:%.*]] = load ptr addrspace(200), ptr addrspace(200) [[VTABLE_I]], align 16
; CHECK-NEXT:    call addrspace(200) void [[FN_I]](ptr addrspace(200) [[THIS]])
; CHECK-NEXT:    ret void
;
entry:
  call void @call_via_vtable(ptr addrspace(200) %this)
  ret void
}

define internal void @call_via_vtable(ptr addrspace(200) %this) unnamed_addr addrspace(200) {
entry:
  %vtable = load ptr addrspace(200), ptr addrspace(200) %this, align 16
  %fn = load ptr addrspace(200), ptr addrspace(200) %vtable, align 16
  call void %fn(ptr addrspace(200) %this)
  ret void
}