diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-16 20:12:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-16 20:12:52 +0000 |
commit | db2d9613d23c86080874f902a32725e56d5e1eba (patch) | |
tree | 23ca139012dacf572eaca7232c622e1edec97066 /llvm/lib | |
parent | 733256fe3142ffd5afffd56cf109855d88925d23 (diff) | |
download | bcm5719-llvm-db2d9613d23c86080874f902a32725e56d5e1eba.tar.gz bcm5719-llvm-db2d9613d23c86080874f902a32725e56d5e1eba.zip |
Fix PR3335 by not turning a store to one address space into a store to another.
llvm-svn: 62351
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 1175374748b..c02fabd9c0c 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -11169,7 +11169,11 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) { if (!SrcPTy->isInteger() && !isa<PointerType>(SrcPTy)) return 0; - if (IC.getTargetData().getTypeSizeInBits(SrcPTy) != + // If the pointers point into different address spaces or if they point to + // values with different sizes, we can't do the transformation. + if (SrcTy->getAddressSpace() != + cast<PointerType>(CI->getType())->getAddressSpace() || + IC.getTargetData().getTypeSizeInBits(SrcPTy) != IC.getTargetData().getTypeSizeInBits(DestPTy)) return 0; |