[llvm] [BOLT] Simplify RAState helpers (NFCI) (PR #162820)

Gergely Bálint via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 28 04:42:57 PDT 2025


================
@@ -81,10 +86,15 @@ void InsertNegateRAState::coverFunctionFragmentStart(BinaryFunction &BF,
       });
   // If a function is already split in the input, the first FF can also start
   // with Signed state. This covers that scenario as well.
-  if (BC.MIB->isRASigned(*((*FirstNonEmpty)->begin()))) {
+  auto RAState = BC.MIB->getRAState(*(*FirstNonEmpty)->begin());
+  if (!RAState) {
+    BC.errs() << "BOLT-ERROR: unknown RAState after inferUnknownStates "
+              << " in function " << BF.getPrintName() << "\n";
+    return;
----------------
bgergely0 wrote:

Yes, these probably should be fatal errors at this point. Not sure if bubbling up errors are the preferred way. If not, I think I'd just go with an llvm_unreachable, as this really shouldn't happen based on the function's logic.
WDYT?

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


More information about the llvm-commits mailing list