[llvm] a886870 - [TableGen] Use std::map::try_emplace to simplify code in GlobalISelEmitter. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 10:11:19 PDT 2023


Author: Craig Topper
Date: 2023-08-22T10:10:35-07:00
New Revision: a886870bc8ace9bdb03422403f8c673b05d9b3aa

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

LOG: [TableGen] Use std::map::try_emplace to simplify code in GlobalISelEmitter. NFC

Added: 
    

Modified: 
    llvm/utils/TableGen/GlobalISelEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index fca9fc59fab061..1c368606f47846 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -2520,9 +2520,7 @@ void GlobalISelEmitter::run(raw_ostream &OS) {
 }
 
 void GlobalISelEmitter::declareSubtargetFeature(Record *Predicate) {
-  if (SubtargetFeatures.count(Predicate) == 0)
-    SubtargetFeatures.emplace(
-        Predicate, SubtargetFeatureInfo(Predicate, SubtargetFeatures.size()));
+  SubtargetFeatures.try_emplace(Predicate, Predicate, SubtargetFeatures.size());
 }
 
 } // end anonymous namespace


        


More information about the llvm-commits mailing list