diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2017-06-26 03:31:31 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2017-06-26 03:31:31 +0000 |
commit | 2abb65ae11c56e571f4164e32d81e9d100a0360b (patch) | |
tree | c6ba5380caf6ff22f227dc0e0b0d2615b9e7038c /llvm/include | |
parent | 69f49ce83c67ced4254befe6ff49a09c08eadd10 (diff) | |
download | bcm5719-llvm-2abb65ae11c56e571f4164e32d81e9d100a0360b.tar.gz bcm5719-llvm-2abb65ae11c56e571f4164e32d81e9d100a0360b.zip |
[InstCombine] Factor the logic for propagating !nonnull and !range
metadata out of InstCombine and into helpers.
NFC, this just exposes the logic used by InstCombine when propagating
metadata from one load instruction to another. The plan is to use this
in SROA to address PR32902.
If anyone has better ideas about how to factor this or name variables,
I'm all ears, but this seemed like a pretty good start and lets us make
progress on the PR.
This is based on a patch by Ariel Ben-Yehuda (D34285).
llvm-svn: 306267
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/Transforms/Utils/Local.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h index 8fed292e77a..30b27616cd9 100644 --- a/llvm/include/llvm/Transforms/Utils/Local.h +++ b/llvm/include/llvm/Transforms/Utils/Local.h @@ -380,6 +380,19 @@ unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT, /// during lowering by the GC infrastructure. bool callsGCLeafFunction(ImmutableCallSite CS); +/// Copy a nonnull metadata node to a new load instruction. +/// +/// This handles mapping it to range metadata if the new load is an integer +/// load instead of a pointer load. +void copyNonnullMetadata(const LoadInst &OldLI, MDNode *N, LoadInst &NewLI); + +/// Copy a range metadata node to a new load instruction. +/// +/// This handles mapping it to nonnull metadata if the new load is a pointer +/// load instead of an integer load and the range doesn't cover null. +void copyRangeMetadata(const DataLayout &DL, const LoadInst &OldLI, MDNode *N, + LoadInst &NewLI); + //===----------------------------------------------------------------------===// // Intrinsic pattern matching // |