summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/AsmMatcherEmitter.cpp
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2016-06-23 17:09:49 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2016-06-23 17:09:49 +0000
commitef3358d5797a2d38f6f885a9f1d5fe771b6e7119 (patch)
tree50b6d30d7075c33a7928215c472ea6aaf1b53959 /llvm/utils/TableGen/AsmMatcherEmitter.cpp
parent31ae3c5ade4f7ec5d5b54c1bddbe8a8cb5e8f950 (diff)
downloadbcm5719-llvm-ef3358d5797a2d38f6f885a9f1d5fe771b6e7119.tar.gz
bcm5719-llvm-ef3358d5797a2d38f6f885a9f1d5fe771b6e7119.zip
[TableGen] Use StringRef::compare instead of != and <. NFC.
The previous code would always do 1 or 2 prefix compares; explicitly only do one. This speeds up debug -gen-asm-matcher by ~10% (e.g. X86: 40s -> 35s). llvm-svn: 273583
Diffstat (limited to 'llvm/utils/TableGen/AsmMatcherEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/AsmMatcherEmitter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 19bb0b4c805..76228e0b658 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -579,8 +579,8 @@ struct MatchableInfo {
/// operator< - Compare two matchables.
bool operator<(const MatchableInfo &RHS) const {
// The primary comparator is the instruction mnemonic.
- if (Mnemonic != RHS.Mnemonic)
- return Mnemonic < RHS.Mnemonic;
+ if (int Cmp = Mnemonic.compare(RHS.Mnemonic))
+ return Cmp == -1;
if (AsmOperands.size() != RHS.AsmOperands.size())
return AsmOperands.size() < RHS.AsmOperands.size();
OpenPOWER on IntegriCloud