[PATCH] D54533: InstCombine: don't assume malloc will never return nullptr

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 14 11:33:16 PST 2018


efriedma added a comment.

I don't think any of your testcases actually indicate a bug.

Yes, the compiler isn't allowed to assume the libc implementation of malloc doesn't return null, but that's not what's happening here.  Instead, we're substituting in our own implementation of malloc, and we can make additional guarantees about that implementation.  (This is similar to https://reviews.llvm.org/D53362 , except we don't actually allocate any memory because we prove the allocation is dead.)


Repository:
  rL LLVM

https://reviews.llvm.org/D54533





More information about the llvm-commits mailing list