summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2015-11-17 00:15:09 +0000
committerPhilip Reames <listmail@philipreames.com>2015-11-17 00:15:09 +0000
commitb6e8fe3dacb49dfe4c67dbc3cc40d59cd902f519 (patch)
tree41f5a4c88e7fb2f0ce74b8a7989ec21657233cf4 /llvm/lib
parentdbd2d32892e83d270b6fedc54ea301f75e8ae0ac (diff)
downloadbcm5719-llvm-b6e8fe3dacb49dfe4c67dbc3cc40d59cd902f519.tar.gz
bcm5719-llvm-b6e8fe3dacb49dfe4c67dbc3cc40d59cd902f519.zip
[PRE] Preserve !invariant.load metadata
Spoted via inspection. Test case included. llvm-svn: 253275
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index e2822e320a8..06faa2d76b6 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1669,6 +1669,8 @@ bool GVN::PerformLoadPRE(LoadInst *LI, AvailValInBlkVect &ValuesPerBlock,
if (Tags)
NewLoad->setAAMetadata(Tags);
+ if (auto *MD = LI->getMetadata(LLVMContext::MD_invariant_load))
+ NewLoad->setMetadata(LLVMContext::MD_invariant_load, MD);
if (auto *InvGroupMD = LI->getMetadata(LLVMContext::MD_invariant_group))
NewLoad->setMetadata(LLVMContext::MD_invariant_group, InvGroupMD);
OpenPOWER on IntegriCloud