[PATCH] D27114: Preserve nonnull metadata on Loads through SROA & mem2reg.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 1 15:35:34 PST 2016
efriedma added inline comments.
================
Comment at: lib/Transforms/Utils/PromoteMemoryToRegister.cpp:392
+ // We're replacing this Load with another Load, so let's preserve metadata
+ if (isa<LoadInst>(ReplVal)) {
+ SmallVector<std::pair<unsigned, MDNode *>, 8> MD;
----------------
This isn't a legal transform: you're assigning "nonnull" to a completely unrelated instruction (which could have other users) just because it happens to be a LoadInst. I guess you could get away with this if you can prove there aren't any other uses of the value, though.
https://reviews.llvm.org/D27114
More information about the llvm-commits
mailing list