@@ -1068,29 +1068,19 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
1068
1068
1069
1069
// We can't create address space casts here because we don't know if they're
1070
1070
// safe for the target.
1071
- if (cpySrc->getType ()->getPointerAddressSpace () !=
1072
- cpyDest->getType ()->getPointerAddressSpace ())
1071
+ if (cpySrc->getType () != cpyDest->getType ())
1073
1072
return false ;
1074
1073
for (unsigned ArgI = 0 ; ArgI < C->arg_size (); ++ArgI)
1075
1074
if (C->getArgOperand (ArgI)->stripPointerCasts () == cpySrc &&
1076
- cpySrc->getType ()->getPointerAddressSpace () !=
1077
- C->getArgOperand (ArgI)->getType ()->getPointerAddressSpace ())
1075
+ cpySrc->getType () != C->getArgOperand (ArgI)->getType ())
1078
1076
return false ;
1079
1077
1080
1078
// All the checks have passed, so do the transformation.
1081
1079
bool changedArgument = false ;
1082
1080
for (unsigned ArgI = 0 ; ArgI < C->arg_size (); ++ArgI)
1083
1081
if (C->getArgOperand (ArgI)->stripPointerCasts () == cpySrc) {
1084
- Value *Dest = cpySrc->getType () == cpyDest->getType () ? cpyDest
1085
- : CastInst::CreatePointerCast (cpyDest, cpySrc->getType (),
1086
- cpyDest->getName (), C);
1087
1082
changedArgument = true ;
1088
- if (C->getArgOperand (ArgI)->getType () == Dest->getType ())
1089
- C->setArgOperand (ArgI, Dest);
1090
- else
1091
- C->setArgOperand (ArgI, CastInst::CreatePointerCast (
1092
- Dest, C->getArgOperand (ArgI)->getType (),
1093
- Dest->getName (), C));
1083
+ C->setArgOperand (ArgI, cpyDest);
1094
1084
}
1095
1085
1096
1086
if (!changedArgument)
@@ -1855,9 +1845,8 @@ bool MemCpyOptPass::processByValArgument(CallBase &CB, unsigned ArgNo) {
1855
1845
DT) < *ByValAlign)
1856
1846
return false ;
1857
1847
1858
- // The address space of the memcpy source must match the byval argument
1859
- if (MDep->getSource ()->getType ()->getPointerAddressSpace () !=
1860
- ByValArg->getType ()->getPointerAddressSpace ())
1848
+ // The type of the memcpy source must match the byval argument
1849
+ if (MDep->getSource ()->getType () != ByValArg->getType ())
1861
1850
return false ;
1862
1851
1863
1852
// Verify that the copied-from memory doesn't change in between the memcpy and
@@ -1931,9 +1920,8 @@ bool MemCpyOptPass::processImmutArgument(CallBase &CB, unsigned ArgNo) {
1931
1920
if (!MDep || MDep->isVolatile () || AI != MDep->getDest ())
1932
1921
return false ;
1933
1922
1934
- // The address space of the memcpy source must match the immut argument
1935
- if (MDep->getSource ()->getType ()->getPointerAddressSpace () !=
1936
- ImmutArg->getType ()->getPointerAddressSpace ())
1923
+ // The type of the memcpy source must match the immut argument
1924
+ if (MDep->getSource ()->getType () != ImmutArg->getType ())
1937
1925
return false ;
1938
1926
1939
1927
// 2-1. The length of the memcpy must be equal to the size of the alloca.
0 commit comments