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