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

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 12 18:07:39 PDT 2021


aqjune added a comment.

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.


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