[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:
Nikita Popov 2021-06-21 20:11:39 +02:00
parent d9fe96fe26
commit a969bdc56f
1 changed files with 0 additions and 6 deletions

View File

@ -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