[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
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
index a3dd56c..c61d869 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
@@ -90,9 +90,11 @@
     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);