summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2014-10-22 16:37:13 +0000
committerPhilip Reames <listmail@philipreames.com>2014-10-22 16:37:13 +0000
commitd92c2a75926fb4cf6e206ba3c2c9698065958243 (patch)
treea37e53e898d90da50558f6c8b5240fd26aad5fb1 /llvm/lib/Transforms
parenta92fa4474050c4a125b539516faf6c90893daecd (diff)
downloadbcm5719-llvm-d92c2a75926fb4cf6e206ba3c2c9698065958243.tar.gz
bcm5719-llvm-d92c2a75926fb4cf6e206ba3c2c9698065958243.zip
Preserving 'nonnull' metadata in SimplifyCFG
When we hoist two loads above an if, we can preserve the nonnull metadata. We could also do the same for sinking them, but we appear to not handle metadata at all in that case. Thanks to Hal for the review. Differential Revision: http://reviews.llvm.org/D5910 llvm-svn: 220392
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index d79f4ce013f..0e4d779c52e 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1061,7 +1061,8 @@ static bool HoistThenElseCodeToIf(BranchInst *BI, const DataLayout *DL) {
LLVMContext::MD_tbaa,
LLVMContext::MD_range,
LLVMContext::MD_fpmath,
- LLVMContext::MD_invariant_load
+ LLVMContext::MD_invariant_load,
+ LLVMContext::MD_nonnull
};
combineMetadata(I1, I2, KnownIDs);
I2->eraseFromParent();
@@ -1311,6 +1312,8 @@ static bool SinkThenElseCodeToEnd(BranchInst *BI1) {
if (!I2->use_empty())
I2->replaceAllUsesWith(I1);
I1->intersectOptionalDataWith(I2);
+ // TODO: Use combineMetadata here to preserve what metadata we can
+ // (analogous to the hoisting case above).
I2->eraseFromParent();
if (UpdateRE1)
OpenPOWER on IntegriCloud