[llvm] [NFC][NVPTX] Cleanup getPreferredVectorAction() (PR #114115)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 13:56:57 PDT 2024


================
@@ -1337,8 +1337,6 @@ NVPTXTargetLowering::getPreferredVectorAction(MVT VT) const {
   if (!VT.isScalableVector() && VT.getVectorNumElements() != 1 &&
       VT.getScalarType() == MVT::i1)
     return TypeSplitVector;
-  if (Isv2x16VT(VT))
-    return TypeLegal;
   return TargetLoweringBase::getPreferredVectorAction(VT);
----------------
justinfargnoli wrote:

Yes, that's a good point. 

My description should have been more accurate. The reason we should delete this isn't because we should rely on the default implementation of `getPreferredVectorAction()`; it's because it's dead code. 

[Before calling `getPreferredVectorAction()`](https://github.com/llvm/llvm-project/blob/a78861fc55d18046989ff4d624a037e9181da170/llvm/lib/CodeGen/TargetLoweringBase.cpp#L1406), we first [check whether the type is legal](https://github.com/llvm/llvm-project/blob/a78861fc55d18046989ff4d624a037e9181da170/llvm/lib/CodeGen/TargetLoweringBase.cpp#L1399-L1400). Thus, 
```
if (Isv2x16VT(VT))
    return TypeLegal;
```
will never be triggered. 

https://github.com/llvm/llvm-project/pull/114115


More information about the llvm-commits mailing list