diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-01-02 23:25:28 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-01-02 23:25:28 +0000 |
commit | b38ad88e9f72059374742dbb7341ee29d86cfbfd (patch) | |
tree | 313451d4ffa0a683e042ced17dfd39fbfde80c56 | |
parent | dadcc1827618e2993576e16389e5d7a71db6aa32 (diff) | |
download | bcm5719-llvm-b38ad88e9f72059374742dbb7341ee29d86cfbfd.tar.gz bcm5719-llvm-b38ad88e9f72059374742dbb7341ee29d86cfbfd.zip |
[InstCombine] use combineMetadataForCSE instead of copying it; NFCI
llvm-svn: 290844
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index 5276bee4e0a..388c5e4e7fa 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -850,20 +850,10 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { // separated by a few arithmetic operations. BasicBlock::iterator BBI(LI); bool IsLoadCSE = false; - if (Value *AvailableVal = - FindAvailableLoadedValue(&LI, LI.getParent(), BBI, - DefMaxInstsToScan, AA, &IsLoadCSE)) { - if (IsLoadCSE) { - LoadInst *NLI = cast<LoadInst>(AvailableVal); - unsigned KnownIDs[] = { - LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope, - LLVMContext::MD_noalias, LLVMContext::MD_range, - LLVMContext::MD_invariant_load, LLVMContext::MD_nonnull, - LLVMContext::MD_invariant_group, LLVMContext::MD_align, - LLVMContext::MD_dereferenceable, - LLVMContext::MD_dereferenceable_or_null}; - combineMetadata(NLI, &LI, KnownIDs); - }; + if (Value *AvailableVal = FindAvailableLoadedValue( + &LI, LI.getParent(), BBI, DefMaxInstsToScan, AA, &IsLoadCSE)) { + if (IsLoadCSE) + combineMetadataForCSE(cast<LoadInst>(AvailableVal), &LI); return replaceInstUsesWith( LI, Builder->CreateBitOrPointerCast(AvailableVal, LI.getType(), |