summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-11-27 21:25:13 +0000
committerDavide Italiano <davide@freebsd.org>2017-11-27 21:25:13 +0000
commitb5d59e73eec454961e56316ad5140088bdc93f50 (patch)
tree666d2db8da1c101358302965467e94e9926c3f5d /llvm/lib/Transforms/Scalar
parent2072552360079082237f6a1aef4b00da0ee9d69d (diff)
downloadbcm5719-llvm-b5d59e73eec454961e56316ad5140088bdc93f50.tar.gz
bcm5719-llvm-b5d59e73eec454961e56316ad5140088bdc93f50.zip
[SROA] Propagate !range metadata when moving loads.
This tries to propagate !range metadata to a pre-existing load when a load is optimized out. This is done instead of adding an assume because converting loads to and from assumes creates a lot of IR. Patch by Ariel Ben-Yehuda. Differential Revision: https://reviews.llvm.org/D37216 llvm-svn: 319096
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 2d668f940fb..85479609f3d 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -2455,15 +2455,10 @@ private:
// are different types, for example by mapping !nonnull metadata to
// !range metadata by modeling the null pointer constant converted to the
// integer type.
- // FIXME: Add support for range metadata here. Currently the utilities
- // for this don't propagate range metadata in trivial cases from one
- // integer load to another, don't handle non-addrspace-0 null pointers
- // correctly, and don't have any support for mapping ranges as the
- // integer type becomes winder or narrower.
if (MDNode *N = LI.getMetadata(LLVMContext::MD_nonnull))
copyNonnullMetadata(LI, N, *NewLI);
-
- // Try to preserve nonnull metadata
+ if (MDNode *N = LI.getMetadata(LLVMContext::MD_range))
+ copyRangeMetadata(DL, LI, N, *NewLI);
V = NewLI;
// If this is an integer load past the end of the slice (which means the
@@ -3654,7 +3649,7 @@ bool SROA::presplitLoadsAndStores(AllocaInst &AI, AllocaSlices &AS) {
PartPtrTy, BasePtr->getName() + "."),
getAdjustedAlignment(LI, PartOffset, DL), /*IsVolatile*/ false,
LI->getName());
- PLoad->copyMetadata(*LI, LLVMContext::MD_mem_parallel_loop_access);
+ PLoad->copyMetadata(*LI, LLVMContext::MD_mem_parallel_loop_access);
// Append this load onto the list of split loads so we can find it later
// to rewrite the stores.
OpenPOWER on IntegriCloud