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l6-zUT9PQkWiahJGO_-lFc9IRDbaqWzD9aD65QgiMKJ3sYdhnfmTmMCcYHwf55tpP-k65vChPFXmleRMhvQ0MYeM0fQFjQ9dKN-tkjbHR6ujcKfSviD7ir8P7iK_XXPd4CK85_QVi_I3EWCOA1HXNqqIsNgyqdpsVOUtZtk0qnidQ55tiW9W0pkkWJj6lHwf7qtllzTbbshXz7qjN7oTXkB7syhu5-7l48Cis9YFjj3lG82R13FW8yGBTbrK6YaxIedGwalvXCa-qzbZI25VkNUi7i_L7KN-vft2l2NEEu1malmmRb_Js3bJNmqR8m7Z525Z5jR0bepxd64E42nQrsxtM1r6zKJR407IXIbPh2gEwR-iEk7D7hl7Hm-nE8fEaGSbeeDMNI4ENM2mauXY1BLobovwXk8pMDg>53250</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Missing attribute inference for allocation wrappers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
preames
</td>
</tr>
</table>
<pre>
When looking at the IR generated for a simple wrapper around malloc, I noticed that we appear to not be inferring either noundef or inaccessiblememonly.
`#include <cstdlib>
#include <chrono>
#include <thread>
#include <unistd.h>
void* wrapper() {
void *o = malloc(8);
return o;
}
`
clang -S -emit-llvm -O3 malloc-signature.cpp
`; ModuleID = 'malloc-signature.cpp'
source_filename = "malloc-signature.cpp"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: mustprogress nofree nounwind uwtable willreturn
define dso_local noalias i8* @_Z7wrapperv() local_unnamed_addr #0 {
entry:
%call = tail call noalias align 16 dereferenceable_or_null(8) i8* @malloc(i64 8) #2
ret i8* %call
}
; Function Attrs: inaccessiblememonly mustprogress nofree nounwind willreturn
declare dso_local noalias noundef i8* @malloc(i64 noundef) local_unnamed_addr #1
attributes #0 = { mustprogress nofree nounwind uwtable willreturn "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { inaccessiblememonly mustprogress nofree nounwind willreturn "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }
!llvm.module.flags = !{!0, !1}
!llvm.ident = !{!2}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"uwtable", i32 1}
!2 = !{!"clang version 14.0.0 (https://github.com/llvm/llvm-project.git bbba86764ae8f9365a1a3908c50eb54698b2b203)"}
`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlVktv4zYQ_jXyhZAhUdbDBx-SuAFyWBToHgr0YlDUSGZDkQYfcdJf36FetvNY7KLHAgJFar55cPTNkLVu3nZ_HkERqfWzUB1hjrgjkKc_SAcKDHPQkFYbwogV_UkCORt2OgF-MNqrhvRMSs0j-kCeiNJOcMS7I1o5AwlAZojTQUJqIEK1YExwAwK9GPyONqAl6EAoxjlYK2oJPfRaybd1lOyj5G4aiySimVBc-gZIlD1w6xop6ij7bQLcSo9GK_2F0B0NsOYLoVcCLa-PF_EwvmjRRPRu3n9Eq4huSVTej2JCAoAgQqOR_ZKXKsCibEEZcN4oopdPUbm_bHCYcMkwQ_F3EkMvXCzlS0_i37PJZGxFpxgagTU_nS6q2T35phsv4Wk_BBDR8lMFWo46VnvD4dAKCYr1MOnQz3XoqOOY6cCRhjkm2Zv2btaCuI-yO4hPtMRI7jI6DGGZ3i7DrNgMQyzmSVsFpZRWsarCpJh1UPY9DYm-9e-MCEycfL9WxQGBXj0rfVaxFMq_xp3yi9Y0YoIeveJOaEXunDMWHZDeW3cyujPIPGRjawAGUp4FctufHasD5YWU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