@@ -1114,29 +1114,33 @@ unsigned SITargetLowering::getVectorTypeBreakdownForCallingConv(
1114
1114
Context, CC, VT, IntermediateVT, NumIntermediates, RegisterVT);
1115
1115
}
1116
1116
1117
- static EVT memVTFromLoadIntrData(Type *Ty, unsigned MaxNumLanes) {
1117
+ static EVT memVTFromLoadIntrData(const SITargetLowering &TLI,
1118
+ const DataLayout &DL, Type *Ty,
1119
+ unsigned MaxNumLanes) {
1118
1120
assert(MaxNumLanes != 0);
1119
1121
1122
+ LLVMContext &Ctx = Ty->getContext();
1120
1123
if (auto *VT = dyn_cast<FixedVectorType>(Ty)) {
1121
1124
unsigned NumElts = std::min(MaxNumLanes, VT->getNumElements());
1122
- return EVT::getVectorVT(Ty->getContext(),
1123
- EVT::getEVT(VT->getElementType()),
1125
+ return EVT::getVectorVT(Ctx, TLI.getValueType(DL, VT->getElementType()),
1124
1126
NumElts);
1125
1127
}
1126
1128
1127
- return EVT::getEVT( Ty);
1129
+ return TLI.getValueType(DL, Ty);
1128
1130
}
1129
1131
1130
1132
// Peek through TFE struct returns to only use the data size.
1131
- static EVT memVTFromLoadIntrReturn(Type *Ty, unsigned MaxNumLanes) {
1133
+ static EVT memVTFromLoadIntrReturn(const SITargetLowering &TLI,
1134
+ const DataLayout &DL, Type *Ty,
1135
+ unsigned MaxNumLanes) {
1132
1136
auto *ST = dyn_cast<StructType>(Ty);
1133
1137
if (!ST)
1134
- return memVTFromLoadIntrData(Ty, MaxNumLanes);
1138
+ return memVTFromLoadIntrData(TLI, DL, Ty, MaxNumLanes);
1135
1139
1136
1140
// TFE intrinsics return an aggregate type.
1137
1141
assert(ST->getNumContainedTypes() == 2 &&
1138
1142
ST->getContainedType(1)->isIntegerTy(32));
1139
- return memVTFromLoadIntrData(ST->getContainedType(0), MaxNumLanes);
1143
+ return memVTFromLoadIntrData(TLI, DL, ST->getContainedType(0), MaxNumLanes);
1140
1144
}
1141
1145
1142
1146
/// Map address space 7 to MVT::v5i32 because that's its in-memory
@@ -1221,10 +1225,12 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
1221
1225
MaxNumLanes = DMask == 0 ? 1 : llvm::popcount(DMask);
1222
1226
}
1223
1227
1224
- Info.memVT = memVTFromLoadIntrReturn(CI.getType(), MaxNumLanes);
1228
+ Info.memVT = memVTFromLoadIntrReturn(*this, MF.getDataLayout(),
1229
+ CI.getType(), MaxNumLanes);
1225
1230
} else {
1226
- Info.memVT = memVTFromLoadIntrReturn(
1227
- CI.getType(), std::numeric_limits<unsigned>::max());
1231
+ Info.memVT =
1232
+ memVTFromLoadIntrReturn(*this, MF.getDataLayout(), CI.getType(),
1233
+ std::numeric_limits<unsigned>::max());
1228
1234
}
1229
1235
1230
1236
// FIXME: What does alignment mean for an image?
@@ -1237,9 +1243,10 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
1237
1243
if (RsrcIntr->IsImage) {
1238
1244
unsigned DMask = cast<ConstantInt>(CI.getArgOperand(1))->getZExtValue();
1239
1245
unsigned DMaskLanes = DMask == 0 ? 1 : llvm::popcount(DMask);
1240
- Info.memVT = memVTFromLoadIntrData(DataTy, DMaskLanes);
1246
+ Info.memVT = memVTFromLoadIntrData(*this, MF.getDataLayout(), DataTy,
1247
+ DMaskLanes);
1241
1248
} else
1242
- Info.memVT = EVT::getEVT( DataTy);
1249
+ Info.memVT = getValueType(MF.getDataLayout(), DataTy);
1243
1250
1244
1251
Info.flags |= MachineMemOperand::MOStore;
1245
1252
} else {
0 commit comments