[llvm] [BOLT] Gadget scanner: analyze functions without CFG information (PR #133461)

Kristof Beyls via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 05:32:34 PDT 2025


================
@@ -124,6 +124,27 @@ class TrackedRegisters {
   }
 };
 
+// Without CFG, we reset gadget scanning state when encountering an
+// unconditional branch. Note that BC.MIB->isUnconditionalBranch neither
+// considers indirect branches nor annotated tail calls as unconditional.
+static bool isStateTrackingBoundary(const BinaryContext &BC,
+                                    const MCInst &Inst) {
----------------
kbeyls wrote:

When reading through this source code file linearly, I guess that this comment may be hard to understand for a "first time reader".
I'm wondering if it would be better to move this function to just before `NoCFGPacRetAnalysis`.
And maybe add a high-level description of how the "NoCFG" analysis works/is different from the regular "CFG" analysis?
That might make it easier to understand this analysis and make it more likely for other in the future to help contribute/improve it?

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


More information about the llvm-commits mailing list