[PATCH] D100785: [InstCombine] Enhance deduction of alignment for aligned_alloc
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 19 16:38:01 PDT 2021
jdoerfert added a comment.
In D100785#2699469 <https://reviews.llvm.org/D100785#2699469>, @xbolva00 wrote:
> In D100785#2699460 <https://reviews.llvm.org/D100785#2699460>, @jdoerfert wrote:
>
>>> The function aligned_alloc() is the same as memalign(), except for the added restriction that size should be a multiple of alignment. So for a non-zero alignment size need to be non-zero.
>>
>> I don't think the last part is true, 0 x Alignment = 0. That said, for non-zero sizes we know alignment holds, so this is fine.
>
> So should we just drop isKnownNonZero check? To allow annotation for case like aligned_alloc(32, dynamicsize)?
No, isKnownNonZero is the important part.
p = aligned_alloc(32, dynamicsize)
===>
dynamicsize == 0 || p % 32 == 0
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100785/new/
https://reviews.llvm.org/D100785
More information about the llvm-commits
mailing list