summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-10-03 14:51:09 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-10-03 14:51:09 +0000
commit92d02027c26733410d5fbb8a10ebf7a3c745e4d8 (patch)
treef0d6d7332e1f4698a4fc4c9d301cfdc1c07cbe30 /llvm
parent925b64be64d7da078c70d621b787015c8073dcca (diff)
downloadbcm5719-llvm-92d02027c26733410d5fbb8a10ebf7a3c745e4d8.tar.gz
bcm5719-llvm-92d02027c26733410d5fbb8a10ebf7a3c745e4d8.zip
[llvm-exegesis] Avoid yaml parser from calling sscanf for obvious non-matches (PR39102)
deserializeMCOperand - ensure that we at least match the first character of the sscanf pattern before calling This reduces llvm-exegesis uops analysis of the instructions supported from btver2 from 5m13s to 2m1s on debug builds. llvm-svn: 343690
Diffstat (limited to 'llvm')
-rw-r--r--llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
index a3dd56ca3a2..c61d869a2a6 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
@@ -90,9 +90,11 @@ private:
assert(!String.empty());
int64_t IntValue = 0;
double DoubleValue = 0;
- if (sscanf(String.data(), kIntegerFormat, &IntValue) == 1)
+ if (String[0] == kIntegerFormat[0] &&
+ sscanf(String.data(), kIntegerFormat, &IntValue) == 1)
return llvm::MCOperand::createImm(IntValue);
- if (sscanf(String.data(), kDoubleFormat, &DoubleValue) == 1)
+ if (String[0] == kDoubleFormat[0] &&
+ sscanf(String.data(), kDoubleFormat, &DoubleValue) == 1)
return llvm::MCOperand::createFPImm(DoubleValue);
if (unsigned RegNo = getRegNo(String))
return llvm::MCOperand::createReg(RegNo);
OpenPOWER on IntegriCloud