1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Utilize CastInst::CreatePointerBitCastOrAddrSpaceCast here.

llvm-svn: 213189
This commit is contained in:
Manuel Jacob 2014-07-16 20:13:45 +00:00
parent 8124ab9a24
commit e41c2e7cde

View File

@ -1582,9 +1582,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
Builder->CreateGEP(StrippedPtr, Idx, GEP.getName());
// V and GEP are both pointer types --> BitCast
if (StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace())
return new BitCastInst(NewGEP, GEP.getType());
return new AddrSpaceCastInst(NewGEP, GEP.getType());
return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP,
GEP.getType());
}
// Transform things like:
@ -1616,9 +1615,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
Builder->CreateGEP(StrippedPtr, NewIdx, GEP.getName());
// The NewGEP must be pointer typed, so must the old one -> BitCast
if (StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace())
return new BitCastInst(NewGEP, GEP.getType());
return new AddrSpaceCastInst(NewGEP, GEP.getType());
return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP,
GEP.getType());
}
}
}
@ -1658,9 +1656,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
Builder->CreateInBoundsGEP(StrippedPtr, Off, GEP.getName()) :
Builder->CreateGEP(StrippedPtr, Off, GEP.getName());
// The NewGEP must be pointer typed, so must the old one -> BitCast
if (StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace())
return new BitCastInst(NewGEP, GEP.getType());
return new AddrSpaceCastInst(NewGEP, GEP.getType());
return CastInst::CreatePointerBitCastOrAddrSpaceCast(NewGEP,
GEP.getType());
}
}
}