forked from OSchip/llvm-project
[InstCombine] Remove unnecessary addres space check (NFC)
It's not possible to bitcast between different address spaces, and this is ensured by the IR verifier. As such, this bitcast to addrspacecast canonicalization can never be hit.
This commit is contained in:
parent
d9fe96fe26
commit
a969bdc56f
|
@ -2621,12 +2621,6 @@ Instruction *InstCombinerImpl::visitBitCast(BitCastInst &CI) {
|
|||
Type *DstElTy = DstPTy->getElementType();
|
||||
Type *SrcElTy = SrcPTy->getElementType();
|
||||
|
||||
// Casting pointers between the same type, but with different address spaces
|
||||
// is an addrspace cast rather than a bitcast.
|
||||
if ((DstElTy == SrcElTy) &&
|
||||
(DstPTy->getAddressSpace() != SrcPTy->getAddressSpace()))
|
||||
return new AddrSpaceCastInst(Src, DestTy);
|
||||
|
||||
// If we are casting a alloca to a pointer to a type of the same
|
||||
// size, rewrite the allocation instruction to allocate the "right" type.
|
||||
// There is no need to modify malloc calls because it is their bitcast that
|
||||
|
|
Loading…
Reference in New Issue