Matt Arsenault 763131ba7f
opt: Add -enable-builtin flag (#145808)
Currently TargetLibraryInfo assumes ~everything is available, and
specific triples (or the -disable-builtin) flag, opt-out. This is a
backwards system, where features should only be positively be enabled
when known. Add this flag to help migrate tests with no triple.
2025-07-08 17:26:03 +09:00

14 lines
652 B
LLVM

; RUN: opt -S -mtriple=amdgcn-- -passes=inferattrs %s | FileCheck -check-prefix=NOBUILTIN %s
; RUN: opt -S -enable-builtin=malloc -mtriple=amdgcn-- -passes=inferattrs %s | FileCheck -check-prefix=WITHBUILTIN %s
; Test that the -enable-builtin flag works and forces recognition of
; malloc despite the target's default TargetLibraryInfo.
; NOBUILTIN: declare ptr @malloc(i64)
; WITHBUILTIN: declare noalias noundef ptr @malloc(i64 noundef) #0
; WITHBUILTIN: attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
declare ptr @malloc(i64)