diff options
| author | Manuel Jacob <me@manueljacob.de> | 2014-07-16 20:13:45 +0000 |
|---|---|---|
| committer | Manuel Jacob <me@manueljacob.de> | 2014-07-16 20:13:45 +0000 |
| commit | 405fb18213415f4f1b253fd5f55e59b5873491d8 (patch) | |
| tree | 7aba1edd3b7793727f8954b5fe5cbaeedbb8fc1f /llvm/lib | |
| parent | df4b763be5897a315751cd071953e11c7d28a175 (diff) | |
| download | bcm5719-llvm-405fb18213415f4f1b253fd5f55e59b5873491d8.tar.gz bcm5719-llvm-405fb18213415f4f1b253fd5f55e59b5873491d8.zip | |
Utilize CastInst::CreatePointerBitCastOrAddrSpaceCast here.
llvm-svn: 213189
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index fe3b8b41fdb..d3648e2d050 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1582,9 +1582,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { Builder->CreateGEP(StrippedPtr, Idx, GEP.getName()); // V and GEP are both pointer types --> BitCast - if (StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace()) - return new BitCastInst(NewGEP, GEP.getType()); - return new AddrSpaceCastInst(NewGEP, GEP.getType()); + return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP, + GEP.getType()); } // Transform things like: @@ -1616,9 +1615,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { Builder->CreateGEP(StrippedPtr, NewIdx, GEP.getName()); // The NewGEP must be pointer typed, so must the old one -> BitCast - if (StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace()) - return new BitCastInst(NewGEP, GEP.getType()); - return new AddrSpaceCastInst(NewGEP, GEP.getType()); + return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP, + GEP.getType()); } } } @@ -1658,9 +1656,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { Builder->CreateInBoundsGEP(StrippedPtr, Off, GEP.getName()) : Builder->CreateGEP(StrippedPtr, Off, GEP.getName()); // The NewGEP must be pointer typed, so must the old one -> BitCast - if (StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace()) - return new BitCastInst(NewGEP, GEP.getType()); - return new AddrSpaceCastInst(NewGEP, GEP.getType()); + return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP, + GEP.getType()); } } } |

