[llvm-branch-commits] [llvm] Add initial support for SPE brstack format (PR #129231)

Paschalis Mpeis via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 10 10:15:21 PDT 2025


================
@@ -1034,7 +1034,11 @@ ErrorOr<LBREntry> DataAggregator::parseLBREntry() {
   if (std::error_code EC = MispredStrRes.getError())
     return EC;
   StringRef MispredStr = MispredStrRes.get();
-  if (MispredStr.size() != 1 ||
+  // SPE brstack mispredicted flags might be two characters long: 'PN' or 'MN'.
+  bool ProperStrSize = (MispredStr.size() == 2 && opts::ArmSPE)
+                           ? (MispredStr[1] == 'N')
+                           : (MispredStr.size() == 1);
+  if (!ProperStrSize ||
       (MispredStr[0] != 'P' && MispredStr[0] != 'M' && MispredStr[0] != '-')) {
     reportError("expected single char for mispred bit");
----------------
paschalis-mpeis wrote:

Here you can show a relevant message for each case, eg the error might be specific to SPE's taken bit or both misspred/taken parsing errors may occur.

You could extract the earlier `MispredStr[0]` checks on another boolean (say `PredictionBitErr`) and reuse?
Also maybe ProperStrSize could get specialized to something like `SpeTakenBitErr`.

https://github.com/llvm/llvm-project/pull/129231


More information about the llvm-branch-commits mailing list