llvm-project/llvm/test/Assembler/struct-ret-without-upgrade.ll
Nikita Popov d6887256c2 [AutoUpgrade] Don't upgrade intrinsics returning overloaded struct type
We only want to do the upgrade from named to anonymous struct
return if the intrinsic is declared to return a struct, but not
if it has an overloaded return type that just happens to be a
struct. In that case the struct type will be mangled into the
intrinsic name and there is no problem.

This should address the problem reported in
https://reviews.llvm.org/D122471#3416598.
2022-03-30 17:27:26 +02:00

19 lines
519 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S < %s | FileCheck %s
; This is an overloaded struct return, we should not try to update it to an
; anonymous struct return.
%ty = type { i32 }
define %ty @test(%ty %arg) {
; CHECK-LABEL: @test(
; CHECK-NEXT: [[COPY:%.*]] = call [[TY:%.*]] @llvm.ssa.copy.s_tys([[TY]] [[ARG:%.*]])
; CHECK-NEXT: ret [[TY]] [[COPY]]
;
%copy = call %ty @llvm.ssa.copy.s_tys(%ty %arg)
ret %ty %copy
}
declare %ty @llvm.ssa.copy.s_tys(%ty)