File: operands-to-args-wrong-call-type-issue69312.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.4-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,236,516 kB
  • sloc: cpp: 7,619,569; ansic: 1,433,956; asm: 1,058,748; python: 252,181; f90: 94,671; objc: 70,753; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,585; awk: 3,523; javascript: 2,272; xml: 892; fortran: 770
file content (44 lines) | stat: -rw-r--r-- 1,576 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
; RUN: llvm-reduce %s -o %t --abort-on-invalid-reduction --delta-passes=operands-to-args --test FileCheck --test-arg %s --test-arg --match-full-lines --test-arg --check-prefix=INTERESTING --test-arg --input-file
; RUN: FileCheck %s --input-file %t --check-prefixes=REDUCED,INTERESTING

; REDUCED-LABEL: define void @func(i32 %k, i32 %extra.arg, ptr %Global, ptr %Local) {

; Keep one reference to the original value.
; INTERESTING: %[[LOCAL:Local[0-9]*]] = alloca i32, align 4

; Everything else must use the function argument.
; REDUCED: store i32 21, ptr %Global, align 4
; REDUCED: store i32 0, ptr %Local, align 4
; REDUCED: store i32 0, ptr %Global, align 4

; Do not add any arguments for %Keep and @GlobalKeep.
; INTERESTING: %[[KEEP:LocalKeep[0-9]*]] = add i32 %k, 21
; INTERESTING: store i32 %[[KEEP]], ptr @GlobalKeep, align 4

; Do not add any arguments if the call type was already mismatched

; INTERESTING-LABEL: define void @mismatched_func_caller() {
; REDUCED:             call void @func(i32 21)

@Global = global i32 42
@GlobalKeep = global i32 42

define void @func(i32 %k, i32 %extra.arg) {
entry:
  %Local = alloca i32, align 4
  store i32 21, ptr @Global, align 4
  store i32 0, ptr %Local, align 4
  store i32 0, ptr @Global, align 4
  %LocalKeep = add i32 %k, 21
  store i32 %LocalKeep, ptr @GlobalKeep, align 4
  ret void
}

; This call has the wrong signature for the original underlying call,
; so getCalledFunction does not return a reference to the function.
define void @mismatched_func_caller() {
entry:
  call void @func(i32 21)
  ret void
}