InstCombine appears to duplicate the allocation size logic used inside getObjectSize when figuring out which attributes are safe to place on the callsite. We can use the existing utility function instead.
The test change is correct. With aligned_alloc, a zero alignment is required to return nullptr. As such, deref_or_null is a correct attribute to use.
Posting for review as the code implementing getObjectSize is a tad subtle, and I want to get a second set of eyes to make sure I'm not missing a more material difference.
clang-format: please reformat the code