[llvm] 991a621 - [TargetLowering] Remove weird use of MVT::isVoid in an assert. (#101436)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 21:53:34 PDT 2024


Author: Craig Topper
Date: 2024-07-31T21:53:31-07:00
New Revision: 991a6215a9ccd99eb91d2b2d46b58c2fd648c263

URL: https://github.com/llvm/llvm-project/commit/991a6215a9ccd99eb91d2b2d46b58c2fd648c263
DIFF: https://github.com/llvm/llvm-project/commit/991a6215a9ccd99eb91d2b2d46b58c2fd648c263.diff

LOG: [TargetLowering] Remove weird use of MVT::isVoid in an assert. (#101436)

At the time this was written there were no vector types in MVT. The
order was:
-scalar integer types
-scalar FP types
-isVoid

I believe this isVoid check was to catch walking off the end of the
scalar FP types. While the isInteger()==isInteger caught walking off the
end of scalar integer types.

These days we have:
-scalar integer types
-scalar FP types
-fixed vector integer types
-fixed vector FP types
-scalable vector integer types
-scalable vector FP types.
-Glue
-isVoid

So checking isVoid doesn't detect what it used to. I've changed it to
check isFloatingPoint() == isFloatingPoint() instead.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/TargetLowering.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 9d9886f4920a2..9ccdbab008aec 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -1640,7 +1640,8 @@ class TargetLoweringBase {
     MVT NVT = VT;
     do {
       NVT = (MVT::SimpleValueType)(NVT.SimpleTy+1);
-      assert(NVT.isInteger() == VT.isInteger() && NVT != MVT::isVoid &&
+      assert(NVT.isInteger() == VT.isInteger() &&
+             NVT.isFloatingPoint() == VT.isFloatingPoint() &&
              "Didn't find type to promote to!");
     } while (VTBits >= NVT.getScalarSizeInBits() || !isTypeLegal(NVT) ||
              getOperationAction(Op, NVT) == Promote);


        


More information about the llvm-commits mailing list