llvm-project/llvm/test/Verifier/alloc-variant-zeroed.ll
clubby789 c7c79d2590
[IR][DSE] Support non-malloc functions in malloc+memset->calloc fold (#138299)
Add a `alloc-variant-zeroed` function attribute which can be used to
inform folding allocation+memset. This addresses
https://github.com/rust-lang/rust/issues/104847, where LLVM does not
know how to perform this transformation for non-C languages.

Co-authored-by: Jamie <jamie@osec.io>
2025-06-04 09:35:20 +02:00

20 lines
862 B
LLVM

; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
; CHECK: 'alloc-variant-zeroed' must not be empty
declare ptr @a(i64) "alloc-variant-zeroed"=""
; CHECK: 'alloc-variant-zeroed' must not be empty
declare ptr @b(i64) "alloc-variant-zeroed"=""
; CHECK: 'alloc-variant-zeroed' must name a function belonging to the same 'alloc-family'
declare ptr @c(i64) "alloc-variant-zeroed"="c_zeroed" "alloc-family"="C"
declare ptr @c_zeroed(i64)
; CHECK: 'alloc-variant-zeroed' must name a function with 'allockind("zeroed")'
declare ptr @d(i64) "alloc-variant-zeroed"="d_zeroed" "alloc-family"="D"
declare ptr @d_zeroed(i64) "alloc-family"="D"
; CHECK: 'alloc-variant-zeroed' must name a function with the same signature
declare ptr @e(i64) "alloc-variant-zeroed"="e_zeroed" "alloc-family"="E"
declare ptr @e_zeroed(i64, i64) "alloc-family"="E" allockind("zeroed")