diff options
| author | Nate Begeman <natebegeman@mac.com> | 2008-03-31 00:22:16 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2008-03-31 00:22:16 +0000 |
| commit | df5b3617cfe24135225e6052cc9d8603682b023e (patch) | |
| tree | f4a3fa7b8c2fc4d0a222c6c9278f930dc0eedd1d /lib/Transforms/Scalar/InstructionCombining.cpp | |
| parent | 5f49cb25f3e7e5df3959c7d9e0f3b89a522797ba (diff) | |
| download | external_llvm-df5b3617cfe24135225e6052cc9d8603682b023e.zip external_llvm-df5b3617cfe24135225e6052cc9d8603682b023e.tar.gz external_llvm-df5b3617cfe24135225e6052cc9d8603682b023e.tar.bz2 | |
Don't eliminate bitcast instructions that change the type of a pointer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48971 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
| -rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 35715fb..9e069fd 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7575,6 +7575,11 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) { const Type *DstElTy = DstPTy->getElementType(); const Type *SrcElTy = SrcPTy->getElementType(); + // If the address spaces don't match, don't eliminate the bitcast, which is + // required for changing types. + if (SrcPTy->getAddressSpace() != DstPTy->getAddressSpace()) + return 0; + // If we are casting a malloc or alloca to a pointer to a type of the same // size, rewrite the allocation instruction to allocate the "right" type. if (AllocationInst *AI = dyn_cast<AllocationInst>(Src)) |
