brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 2147e4d Raw
39 lines · plain
1; RUN: opt < %s -passes=deadargelim -S | FileCheck %s2 3declare void @llvm.va_start(ptr)4 5define internal i32 @va_func(i32 %a, i32 %b, ...) {6  %valist = alloca i87  call void @llvm.va_start(ptr %valist)8 9  ret i32 %b10}11 12; Function derived from AArch64 ABI, where 8 integer arguments go in13; registers but the 9th goes on the stack. We really don't want to put14; just 7 args in registers and then start on the stack since any15; va_arg implementation already present in va_func won't be expecting16; it.17define i32 @call_va(i32 %in) {18  %stacked = alloca i3219  store i32 42, ptr %stacked20  %res = call i32(i32, i32, ...) @va_func(i32 %in, i32 %in, [6 x i32] poison, ptr byval(i32) %stacked)21  ret i32 %res22; CHECK: call i32 (i32, i32, ...) @va_func(i32 poison, i32 %in, [6 x i32] poison, ptr byval(i32) %stacked)23}24 25define internal i32 @va_deadret_func(i32 %a, i32 %b, ...) {26  %valist = alloca i827  call void @llvm.va_start(ptr %valist)28 29  ret i32 %a30}31 32define void @call_deadret(i32 %in) {33  %stacked = alloca i3234  store i32 42, ptr %stacked35  call i32 (i32, i32, ...) @va_deadret_func(i32 poison, i32 %in, [6 x i32] poison, ptr byval(i32) %stacked)36  ret void37; CHECK: call void (i32, i32, ...) @va_deadret_func(i32 poison, i32 poison, [6 x i32] poison, ptr byval(i32) %stacked)38}39