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 | f2b0b0eb17a209d7d07b4eb85f92a755c9c062d6 (patch) | |
| tree | b8282f832119509f8182ba610998f035861c386b /llvm/lib/Transforms | |
| parent | c00c35a857317ef11d7944567320e586479c186e (diff) | |
| download | bcm5719-llvm-f2b0b0eb17a209d7d07b4eb85f92a755c9c062d6.tar.gz bcm5719-llvm-f2b0b0eb17a209d7d07b4eb85f92a755c9c062d6.zip | |
Don't eliminate bitcast instructions that change the type of a pointer
llvm-svn: 48971
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 35715fb8caf..9e069fd05ba 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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)) |

