diff options
author | Dorit Nuzman <dorit.nuzman@intel.com> | 2016-09-04 07:49:39 +0000 |
---|---|---|
committer | Dorit Nuzman <dorit.nuzman@intel.com> | 2016-09-04 07:49:39 +0000 |
commit | abd15f69b2957a38bb2f625eec8b21880004ec9e (patch) | |
tree | 66a2543602e89449ad1d64b5fd374ea647c8b582 /llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | |
parent | 3301c7eebd4ede04916c95caba153908c66fe3f9 (diff) | |
download | bcm5719-llvm-abd15f69b2957a38bb2f625eec8b21880004ec9e.tar.gz bcm5719-llvm-abd15f69b2957a38bb2f625eec8b21880004ec9e.zip |
[InstCombine] Preserve llvm.mem.parallel_loop_access metadata when replacing
memcpy with ld/st.
When InstCombine replaces a memcpy with loads+stores it does not copy over the
llvm.mem.parallel_loop_access from the memcpy instruction. This patch fixes
that.
Differential Revision: https://reviews.llvm.org/D23499
llvm-svn: 280617
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index b5e206474e0..15069e62a73 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -192,11 +192,17 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) { L->setAlignment(SrcAlign); if (CopyMD) L->setMetadata(LLVMContext::MD_tbaa, CopyMD); + MDNode *LoopMemParallelMD = + MI->getMetadata(LLVMContext::MD_mem_parallel_loop_access); + if (LoopMemParallelMD) + L->setMetadata(LLVMContext::MD_mem_parallel_loop_access, LoopMemParallelMD); StoreInst *S = Builder->CreateStore(L, Dest, MI->isVolatile()); S->setAlignment(DstAlign); if (CopyMD) S->setMetadata(LLVMContext::MD_tbaa, CopyMD); + if (LoopMemParallelMD) + S->setMetadata(LLVMContext::MD_mem_parallel_loop_access, LoopMemParallelMD); // Set the size of the copy to 0, it will be deleted on the next iteration. MI->setArgOperand(2, Constant::getNullValue(MemOpLength->getType())); |