[llvm] [Github] Skip MIR files for undef check (PR #120919)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 22 13:35:26 PST 2024
https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/120919
>From d8dd909a0cf1e1c9b38e83845a476886a2243d2e Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sun, 22 Dec 2024 21:26:13 +0000
Subject: [PATCH 1/2] [Github] Skip MIR files for undef check
This patch skips checking files with a .mir extension for the presence of
undef. This was creating false positives that got reported on discourse.
---
llvm/utils/git/code-format-helper.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index 36fc5ee4c3d527..2aac9930682ef1 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -379,6 +379,10 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str
# Each file is prefixed like:
# diff --git a/file b/file
for file in re.split("^diff --git ", stdout, 0, re.MULTILINE):
+ # We skip checking in MIR files as undef is a valid token and not
+ # going away.
+ if file.endswith(".mir"):
+ continue
# search for additions of undef
if re.search(r"^[+](?!\s*#\s*).*(\bundef\b|UndefValue::get)", file, re.MULTILINE):
files.append(re.match("a/([^ ]+)", file.splitlines()[0])[1])
>From 7b3e2a63e15487b99741cd9f6b7a8002d1dc0be8 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Sun, 22 Dec 2024 21:35:15 +0000
Subject: [PATCH 2/2] Python formatting
---
llvm/utils/git/code-format-helper.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index 2aac9930682ef1..48a338aca9c8e6 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -382,7 +382,7 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str
# We skip checking in MIR files as undef is a valid token and not
# going away.
if file.endswith(".mir"):
- continue
+ continue
# search for additions of undef
if re.search(r"^[+](?!\s*#\s*).*(\bundef\b|UndefValue::get)", file, re.MULTILINE):
files.append(re.match("a/([^ ]+)", file.splitlines()[0])[1])
More information about the llvm-commits
mailing list