[llvm] 028b690 - [TableGen] Remove unnecessary check before calling SmallVector::erase. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 21:44:48 PST 2025


Author: Craig Topper
Date: 2025-01-31T21:42:11-08:00
New Revision: 028b69009a221e16076be77752514525b321d012

URL: https://github.com/llvm/llvm-project/commit/028b69009a221e16076be77752514525b321d012
DIFF: https://github.com/llvm/llvm-project/commit/028b69009a221e16076be77752514525b321d012.diff

LOG: [TableGen] Remove unnecessary check before calling SmallVector::erase. NFC

This was checking whether the erase is needed, but erase is safe
to call with equal iterators.

Added: 
    

Modified: 
    llvm/utils/TableGen/DAGISelMatcherOpt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
index f747944543cfd0..66487caa61838f 100644
--- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
@@ -361,8 +361,7 @@ static void FactorNodes(std::unique_ptr<Matcher> &InputMatcherPtr) {
   }
 
   // Trim the array to match the updated end.
-  if (E != OptionsToMatch.end())
-    OptionsToMatch.erase(E, OptionsToMatch.end());
+  OptionsToMatch.erase(E, OptionsToMatch.end());
 
   // If we're down to a single pattern to match, then we don't need this scope
   // anymore.


        


More information about the llvm-commits mailing list