[InstCombine] Enhance deduction of alignment for aligned_alloc
authorDávid Bolvanský <david.bolvansky@gmail.com>
Tue, 20 Apr 2021 00:03:38 +0000 (02:03 +0200)
committerDávid Bolvanský <david.bolvansky@gmail.com>
Tue, 20 Apr 2021 00:04:18 +0000 (02:04 +0200)
commit324d641b75b54a8772c3c9a881eedad62dc5518c
tree9621b948b6c997630828572a69a0adebbc9e373f
parenta2cd6d07691a645bfb8fb5eeeba2eb5970312c7f
[InstCombine] Enhance deduction of alignment for aligned_alloc

This patch improves https://reviews.llvm.org/D76971 (Deduce attributes for aligned_alloc in InstCombine) and implements "TODO" item mentioned in the review of that patch.

> The function aligned_alloc() is the same as memalign(), except for the added restriction that size should be a multiple of alignment.

Currently, we simply bail out if we see a non-constant size - change that.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D100785
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/test/Transforms/InstCombine/deref-alloc-fns.ll