[PATCH] D111515: [InstCombine] Remove attributes after hoisting free above null check

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 10:08:30 PDT 2021


smeenai added a comment.

In D111515#3060167 <https://reviews.llvm.org/D111515#3060167>, @aqjune wrote:

> I thought about the validity of this transformation.
> To be pedantic, the validity is unclear when ptr is
> (1) an out-of-bounds pointer such that (intptr_t)ptr is 0.
> But, I remember people wanted to regard free(ptr) as equivalent to free(null) in that case, so it would be fine.
> (2) a partially undefined pointer s.t. ptr = undef | 1
> But... I couldn't see any such expression appear in practice, and I don't think LLVM is strictly correct with respect to partially undef pointers
>
> Therefore, if the transformation is considered beneficial, I think the optimization is fine.

Thank you! Does the logic and implementation of this particular change (remove any non-null implying attributes when hoisting the call above the null check) make sense to you?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111515/new/

https://reviews.llvm.org/D111515



More information about the llvm-commits mailing list