@@ -1112,29 +1112,33 @@ unsigned SITargetLowering::getVectorTypeBreakdownForCallingConv(
11121112 Context, CC, VT, IntermediateVT, NumIntermediates, RegisterVT);
11131113}
11141114
1115- static EVT memVTFromLoadIntrData(Type *Ty, unsigned MaxNumLanes) {
1115+ static EVT memVTFromLoadIntrData(const SITargetLowering &TLI,
1116+ const DataLayout &DL, Type *Ty,
1117+ unsigned MaxNumLanes) {
11161118 assert(MaxNumLanes != 0);
11171119
1120+ LLVMContext &Ctx = Ty->getContext();
11181121 if (auto *VT = dyn_cast<FixedVectorType>(Ty)) {
11191122 unsigned NumElts = std::min(MaxNumLanes, VT->getNumElements());
1120- return EVT::getVectorVT(Ty->getContext(),
1121- EVT::getEVT(VT->getElementType()),
1123+ return EVT::getVectorVT(Ctx, TLI.getValueType(DL, VT->getElementType()),
11221124 NumElts);
11231125 }
11241126
1125- return EVT::getEVT( Ty);
1127+ return TLI.getValueType(DL, Ty);
11261128}
11271129
11281130// Peek through TFE struct returns to only use the data size.
1129- static EVT memVTFromLoadIntrReturn(Type *Ty, unsigned MaxNumLanes) {
1131+ static EVT memVTFromLoadIntrReturn(const SITargetLowering &TLI,
1132+ const DataLayout &DL, Type *Ty,
1133+ unsigned MaxNumLanes) {
11301134 auto *ST = dyn_cast<StructType>(Ty);
11311135 if (!ST)
1132- return memVTFromLoadIntrData(Ty, MaxNumLanes);
1136+ return memVTFromLoadIntrData(TLI, DL, Ty, MaxNumLanes);
11331137
11341138 // TFE intrinsics return an aggregate type.
11351139 assert(ST->getNumContainedTypes() == 2 &&
11361140 ST->getContainedType(1)->isIntegerTy(32));
1137- return memVTFromLoadIntrData(ST->getContainedType(0), MaxNumLanes);
1141+ return memVTFromLoadIntrData(TLI, DL, ST->getContainedType(0), MaxNumLanes);
11381142}
11391143
11401144/// Map address space 7 to MVT::v5i32 because that's its in-memory
@@ -1219,10 +1223,12 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
12191223 MaxNumLanes = DMask == 0 ? 1 : llvm::popcount(DMask);
12201224 }
12211225
1222- Info.memVT = memVTFromLoadIntrReturn(CI.getType(), MaxNumLanes);
1226+ Info.memVT = memVTFromLoadIntrReturn(*this, MF.getDataLayout(),
1227+ CI.getType(), MaxNumLanes);
12231228 } else {
1224- Info.memVT = memVTFromLoadIntrReturn(
1225- CI.getType(), std::numeric_limits<unsigned>::max());
1229+ Info.memVT =
1230+ memVTFromLoadIntrReturn(*this, MF.getDataLayout(), CI.getType(),
1231+ std::numeric_limits<unsigned>::max());
12261232 }
12271233
12281234 // FIXME: What does alignment mean for an image?
@@ -1235,9 +1241,10 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
12351241 if (RsrcIntr->IsImage) {
12361242 unsigned DMask = cast<ConstantInt>(CI.getArgOperand(1))->getZExtValue();
12371243 unsigned DMaskLanes = DMask == 0 ? 1 : llvm::popcount(DMask);
1238- Info.memVT = memVTFromLoadIntrData(DataTy, DMaskLanes);
1244+ Info.memVT = memVTFromLoadIntrData(*this, MF.getDataLayout(), DataTy,
1245+ DMaskLanes);
12391246 } else
1240- Info.memVT = EVT::getEVT( DataTy);
1247+ Info.memVT = getValueType(MF.getDataLayout(), DataTy);
12411248
12421249 Info.flags |= MachineMemOperand::MOStore;
12431250 } else {
0 commit comments