diff options
| author | Richard Osborne <richard@xmos.com> | 2014-03-25 17:21:35 +0000 |
|---|---|---|
| committer | Richard Osborne <richard@xmos.com> | 2014-03-25 17:21:35 +0000 |
| commit | 9805ec457d8390a0973d3b3efe0b4a913895d7f5 (patch) | |
| tree | c0e89401d2922a3366d6e8b15d1601652efa57d8 /llvm/lib | |
| parent | b88c97f02e3eb35f0cf8ea3a9bf391f5a095367b (diff) | |
| download | bcm5719-llvm-9805ec457d8390a0973d3b3efe0b4a913895d7f5.tar.gz bcm5719-llvm-9805ec457d8390a0973d3b3efe0b4a913895d7f5.zip | |
Reuse earlier variables to make it clear the types involved in the cast.
No functionality change.
llvm-svn: 204732
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index a34acdd8320..4da5b51bf36 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -521,15 +521,14 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) { // the same size. Instead of casting the pointer before // the store, cast the value to be stored. Value *NewCast; - Value *SIOp0 = SI.getOperand(0); Instruction::CastOps opcode = Instruction::BitCast; - Type* CastSrcTy = SIOp0->getType(); + Type* CastSrcTy = DestPTy; Type* CastDstTy = SrcPTy; if (CastDstTy->isPointerTy()) { if (CastSrcTy->isIntegerTy()) opcode = Instruction::IntToPtr; } else if (CastDstTy->isIntegerTy()) { - if (SIOp0->getType()->isPointerTy()) + if (CastSrcTy->isPointerTy()) opcode = Instruction::PtrToInt; } @@ -538,6 +537,7 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) { if (!NewGEPIndices.empty()) CastOp = IC.Builder->CreateInBoundsGEP(CastOp, NewGEPIndices); + Value *SIOp0 = SI.getOperand(0); NewCast = IC.Builder->CreateCast(opcode, SIOp0, CastDstTy, SIOp0->getName()+".c"); SI.setOperand(0, NewCast); |

