[llvm] r288652 - TableGen/Record: Shortcut member access in hottest function

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 4 23:35:09 PST 2016


Author: matze
Date: Mon Dec  5 01:35:09 2016
New Revision: 288652

URL: http://llvm.org/viewvc/llvm-project?rev=288652&view=rev
Log:
TableGen/Record: Shortcut member access in hottest function

This may seem unusual, but makes most debug tblgen builds ~10% faster.
Usually we wouldn't care about speed that much in debug builds, but for
tblgen that also translates into build time.

Modified:
    llvm/trunk/include/llvm/TableGen/Record.h

Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=288652&r1=288651&r2=288652&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Mon Dec  5 01:35:09 2016
@@ -1221,6 +1221,7 @@ public:
 //===----------------------------------------------------------------------===//
 
 class RecordVal {
+  friend class Record;
   Init *Name;
   PointerIntPair<RecTy *, 1, bool> TyAndPrefix;
   Init *Value;
@@ -1359,7 +1360,7 @@ public:
 
   const RecordVal *getValue(const Init *Name) const {
     for (const RecordVal &Val : Values)
-      if (Val.getNameInit() == Name) return &Val;
+      if (Val.Name == Name) return &Val;
     return nullptr;
   }
 
@@ -1369,7 +1370,7 @@ public:
 
   RecordVal *getValue(const Init *Name) {
     for (RecordVal &Val : Values)
-      if (Val.getNameInit() == Name) return &Val;
+      if (Val.Name == Name) return &Val;
     return nullptr;
   }
 




More information about the llvm-commits mailing list