From 3a6a7999b5c195149aaaf69033f4d33fe9e82511 Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 3 May 2024 02:43:36 +0300 Subject: [PATCH] Hanfle filtering `tail call void @llvm.dbg.*` in LLVM IR (#6425) Fixes #6416. Additionally escapes a dot in another copy of an `@llvm.dbg` check. Didn't find any existing tests for IR filtering to update where this filter applies, but did make sure locally that it does start hiding the instructions for clang-17 and clang-18. --- lib/llvm-ir.ts | 2 +- lib/parsers/llvm-pass-dump-parser.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/llvm-ir.ts b/lib/llvm-ir.ts index 2ee5fe3dcbc..161fc623a31 100644 --- a/lib/llvm-ir.ts +++ b/lib/llvm-ir.ts @@ -67,7 +67,7 @@ export class LlvmIrParser { this.namedMetaDirective = /^(![.A-Z_a-z-]+) = (?:distinct )?!{.*}/; this.metaNodeOptionsRe = /(\w+): (!?\d+|\w+|""|"(?:[^"]|\\")*[^\\]")/gi; - this.llvmDebugLine = /^\s*call void @llvm\.dbg\..*$/; + this.llvmDebugLine = /^\s*(tail\s)?call void @llvm\.dbg\..*$/; this.llvmDebugAnnotation = /,? !dbg !\d+/; this.otherMetadataAnnotation = /,? !(?!dbg)[\w.]+ (!\d+)/; this.attributeAnnotation = /,? #\d+(?= )/; diff --git a/lib/parsers/llvm-pass-dump-parser.ts b/lib/parsers/llvm-pass-dump-parser.ts index 2fd17e64e68..9f67b8cdf88 100644 --- a/lib/parsers/llvm-pass-dump-parser.ts +++ b/lib/parsers/llvm-pass-dump-parser.ts @@ -99,7 +99,7 @@ export class LlvmPassDumpParser { // Additional filters conditionally enabled by `filterDebugInfo` this.debugInfoFilters = [ - /^\s+(tail\s)?call void @llvm.dbg.+$/, // dbg calls + /^\s+(tail\s)?call void @llvm\.dbg.+$/, // dbg calls /^\s+DBG_.+$/, // dbg pseudo-instructions /^(!\d+) = (?:distinct )?!DI([A-Za-z]+)\(([^)]+?)\)/, // meta /^(!\d+) = (?:distinct )?!{.*}/, // meta