Skip to content

[utils] avoid splitting pass names with spaces #97371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions llvm/utils/chunk-print-before-all.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@
import re

chunk_id = 0
pass_regex = re.compile(r"\(([\w-]+)\)")

# This function gets the pass name from the following line:
# *** IR Dump Before/After PASS_NAME... ***
def get_pass_name(line, prefix):
# avoid accidentally parsing function name in e.g.
# "*** IR Dump Before InlinerPass on (foo) ***"
line = line.split(" on ")[0]
non_pretty_pass_name = pass_regex.search(line)
# machine function pass names can contain spaces,
# but have a CLI friendly name also, e.g.:
# "*** IR Dump Before Stack Frame Layout Analysis (stack-frame-layout) ***"
if non_pretty_pass_name:
return non_pretty_pass_name.group(1)
short_line = line[line.find(prefix) + len(prefix) + 1 :]
return re.split(" |<", short_line)[0]

Expand Down
Loading