Skip to content

Commit f7344e4

Browse files
committed
Address review feedback, limit masked loads to avoid sub byte element types
1 parent 0ad2f80 commit f7344e4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3527,8 +3527,8 @@ convertMLOADToLoadWithUsedBytesMask(MemSDNode *N, SelectionDAG &DAG) {
35273527

35283528
for (SDValue Op : reverse(Mask->ops())) {
35293529
// We technically only want to do this shift for every
3530-
// iteration *but* the first, but in the first iteration NewMask is 0, so
3531-
// this shift is a no-op.
3530+
// iteration *but* the first, but in the first iteration UsedBytesMask is 0,
3531+
// so this shift is a no-op.
35323532
UsedBytesMask <<= ElementSizeInBytes;
35333533

35343534
// Mask elements must be constants.

llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,12 @@ bool NVPTXTTIImpl::isLegalMaskedLoad(Type *DataTy, Align Alignment,
623623

624624
if (Alignment < DL.getTypeStoreSize(DataTy))
625625
return false;
626-
return true;
626+
627+
// We do not support sub-byte element type masked loads.
628+
auto *VTy = dyn_cast<FixedVectorType>(DataTy);
629+
if (!VTy)
630+
return false;
631+
return VTy->getElementType()->getScalarSizeInBits() >= 8;
627632
}
628633

629634
unsigned NVPTXTTIImpl::getLoadStoreVecRegBitWidth(unsigned AddrSpace) const {

0 commit comments

Comments
 (0)