[BuildLibCalls] Add noundef to allocator fns' size
This is a patch to explicitly mark the size parameter of allocator functions like malloc/realloc/... as noundef. For C/C++: undef can be created from reading an uninitialized variable or padding. Calling a function with uninitialized variable is already UB. Calling malloc with padding value is.. something that's not expected. Padding bits may appear in a coerced aggregate, which doesn't apply to malloc's size. Therefore, malloc's size can be marked as noundef. For transformations that introduce malloc/realloc/..: I ran LLVM unit tests with an updated Alive2 semantics, and found no regression, so it seems okay. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D97045
Loading
Please sign in to comment