[llvm] 2dc3371 - [NFC] Remove redundant range check

Scott Linder via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 15:02:09 PST 2023


Author: Scott Linder
Date: 2023-01-23T23:01:57Z
New Revision: 2dc33713de7ceae3e28a13be1d72c862ec0efb2c

URL: https://github.com/llvm/llvm-project/commit/2dc33713de7ceae3e28a13be1d72c862ec0efb2c
DIFF: https://github.com/llvm/llvm-project/commit/2dc33713de7ceae3e28a13be1d72c862ec0efb2c.diff

LOG: [NFC] Remove redundant range check

Remove gratuitous check introduced in
25c0ea2a5370813f46686918a84e0de27e107d08 which was generating a warning
when compiling under GCC.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/CodeGen.h b/llvm/include/llvm/Support/CodeGen.h
index 77f999f74129..9c557859d46f 100644
--- a/llvm/include/llvm/Support/CodeGen.h
+++ b/llvm/include/llvm/Support/CodeGen.h
@@ -64,7 +64,7 @@ namespace llvm {
   ///
   /// Returns std::nullopt if \p ID is invalid.
   inline std::optional<Level> getLevel(IDType ID) {
-    if (ID < 0 || ID > 3)
+    if (ID > 3)
       return std::nullopt;
     return static_cast<Level>(ID);
   }


        


More information about the llvm-commits mailing list