[PATCH] D27114: Preserve nonnull metadata on Loads through SROA & mem2reg.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 09:56:04 PST 2016


efriedma added a comment.

> The problem wasn't that. We do have llvm.assume which InstCombine turns assume( (load addr) != null ) to a load addr !nonnull. Then, SROA/mem2reg end up eating the !nonnull metadata.

You can do the reverse transform in mem2reg: load addr !nonnull -> assume( (load addr) != null ), then when the load gets erased the nonnull assumption is preserved.


https://reviews.llvm.org/D27114





More information about the llvm-commits mailing list