diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-11-19 05:56:52 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-11-19 05:56:52 +0000 |
commit | 67cf9a723ba5cf0a711efcb317b241104b558779 (patch) | |
tree | e362be29f8f95e45470715ea59a93f2b8ad86de9 /llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | |
parent | 3b39e88ae0e1f260ebb89f874d8006cb0b87fd2f (diff) | |
download | bcm5719-llvm-67cf9a723ba5cf0a711efcb317b241104b558779.tar.gz bcm5719-llvm-67cf9a723ba5cf0a711efcb317b241104b558779.zip |
Revert "Change memcpy/memset/memmove to have dest and source alignments."
This reverts commit r253511.
This likely broke the bots in
http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux2/builds/20202
http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/3787
llvm-svn: 253543
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 2bc96cce42c..cde26cc24c2 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -60,18 +60,14 @@ static Type *reduceToSingleValueType(Type *T) { return T; } -Instruction *InstCombiner::SimplifyMemTransfer(MemTransferInst *MI) { +Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) { unsigned DstAlign = getKnownAlignment(MI->getArgOperand(0), DL, MI, AC, DT); unsigned SrcAlign = getKnownAlignment(MI->getArgOperand(1), DL, MI, AC, DT); - unsigned CopyDestAlign = MI->getDestAlignment(); - unsigned CopySrcAlign = MI->getSrcAlignment(); + unsigned MinAlign = std::min(DstAlign, SrcAlign); + unsigned CopyAlign = MI->getAlignment(); - if (CopyDestAlign < DstAlign) { - MI->setDestAlignment(DstAlign); - return MI; - } - if (CopySrcAlign < SrcAlign) { - MI->setSrcAlignment(SrcAlign); + if (CopyAlign < MinAlign) { + MI->setAlignment(ConstantInt::get(MI->getAlignmentType(), MinAlign, false)); return MI; } @@ -139,8 +135,8 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemTransferInst *MI) { // If the memcpy/memmove provides better alignment info than we can // infer, use it. - SrcAlign = std::max(SrcAlign, CopySrcAlign); - DstAlign = std::max(DstAlign, CopyDestAlign); + SrcAlign = std::max(SrcAlign, CopyAlign); + DstAlign = std::max(DstAlign, CopyAlign); Value *Src = Builder->CreateBitCast(MI->getArgOperand(1), NewSrcPtrTy); Value *Dest = Builder->CreateBitCast(MI->getArgOperand(0), NewDstPtrTy); @@ -160,8 +156,9 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemTransferInst *MI) { Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) { unsigned Alignment = getKnownAlignment(MI->getDest(), DL, MI, AC, DT); - if (MI->getDestAlignment() < Alignment) { - MI->setDestAlignment(Alignment); + if (MI->getAlignment() < Alignment) { + MI->setAlignment(ConstantInt::get(MI->getAlignmentType(), + Alignment, false)); return MI; } @@ -171,7 +168,7 @@ Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) { if (!LenC || !FillC || !FillC->getType()->isIntegerTy(8)) return nullptr; uint64_t Len = LenC->getLimitedValue(); - Alignment = MI->getDestAlignment(); + Alignment = MI->getAlignment(); assert(Len && "0-sized memory setting should be removed already."); // memset(s,c,n) -> store s, c (for n=1,2,4,8) @@ -746,8 +743,8 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { // If we can determine a pointer alignment that is bigger than currently // set, update the alignment. - if (auto *MTI = dyn_cast<MemTransferInst>(MI)) { - if (Instruction *I = SimplifyMemTransfer(MTI)) + if (isa<MemTransferInst>(MI)) { + if (Instruction *I = SimplifyMemTransfer(MI)) return I; } else if (MemSetInst *MSI = dyn_cast<MemSetInst>(MI)) { if (Instruction *I = SimplifyMemSet(MSI)) |