diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-10-18 11:00:12 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-10-18 11:00:12 +0000 |
commit | be9dccd64d25227832f9cf0c1775acfa072be529 (patch) | |
tree | 0b02ffa55c8e3064c613f6e6fa7c9d40cd24861b /llvm/lib/Transforms | |
parent | 6ec434e8bf816e757041b3bedc78356765dee950 (diff) | |
download | bcm5719-llvm-be9dccd64d25227832f9cf0c1775acfa072be529.tar.gz bcm5719-llvm-be9dccd64d25227832f9cf0c1775acfa072be529.zip |
Preserve AA metadata when combining (cast (load (...))) -> (load (cast
(...))).
llvm-svn: 220141
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index cfdfa00e805..e57091340c0 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -319,6 +319,8 @@ static Instruction *combineLoadToOperationType(InstCombiner &IC, LoadInst &LI) { Value *Ptr = LI.getPointerOperand(); unsigned AS = LI.getPointerAddressSpace(); + AAMDNodes AAInfo; + LI.getAAMetadata(AAInfo); // Fold away bit casts of the loaded value by loading the desired type. if (LI.hasOneUse()) @@ -326,6 +328,7 @@ static Instruction *combineLoadToOperationType(InstCombiner &IC, LoadInst &LI) { LoadInst *NewLoad = IC.Builder->CreateAlignedLoad( IC.Builder->CreateBitCast(Ptr, BC->getDestTy()->getPointerTo(AS)), LI.getAlignment(), LI.getName()); + NewLoad->setAAMetadata(AAInfo); BC->replaceAllUsesWith(NewLoad); IC.EraseInstFromFunction(*BC); return &LI; |