commit e4dfd705e24890b88487199687c4eb7e890e5d0e
parent 03eec1f2ce8811a1762f98bf3edf1c5b4f4fde4d
Author: Jared Tobin <jared@jtobin.io>
Date: Wed, 11 Feb 2026 14:28:21 +0400
fix: filter NCG local labels in isFunctionLabel
NCG-generated labels like Lc*, Ls*, Lu* were being treated as function
labels, causing excessive function count and slow inter-procedural
analysis. Filter them out alongside LLVM local labels.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/Audit/AArch64/CFG.hs b/lib/Audit/AArch64/CFG.hs
@@ -165,8 +165,8 @@ hasFallthrough bb = case lastInstrOf bb of
[] -> Nothing
ls -> lineInstr (last ls)
--- | Check if a label is a function entry (not a local LLVM label).
--- Function labels start with _ or don't have LBB/Lloh prefixes.
+-- | Check if a label is a function entry (not a local label).
+-- Function labels start with _ or don't have LBB/Lloh/Lc prefixes.
isFunctionLabel :: Text -> Bool
isFunctionLabel lbl
| T.isPrefixOf "LBB" lbl = False -- LLVM basic block
@@ -174,6 +174,9 @@ isFunctionLabel lbl
| T.isPrefixOf "LCPI" lbl = False -- LLVM constant pool
| T.isPrefixOf "ltmp" lbl = False -- LLVM temporary
| T.isPrefixOf "l_" lbl = False -- Local label
+ | T.isPrefixOf "Lc" lbl = False -- NCG local label (GHC)
+ | T.isPrefixOf "Ls" lbl = False -- NCG local label (GHC)
+ | T.isPrefixOf "Lu" lbl = False -- NCG local label (GHC)
| otherwise = True -- Likely a function
-- | Get all function entry labels in the CFG.