[PATCH] D28384: Update update_test_checks to work properly with phi nodes and other fun things.
bryant via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 6 09:26:16 PST 2017
bryant added inline comments.
================
Comment at: utils/update_test_checks.py:176
+ if match.group(1) in vars_seen:
+ line = line.replace('%' + match.group(1), get_value_use(match.group(1)), 1)
+ continue
----------------
bryant wrote:
> You're limiting the number of replaced uses to 1. Can a line have more than one use?
Just to clarify, what I meant is that you can do a lot better than manually replacing one at a time:
```
def genericize_check_lines(lines):
def ssaify(match):
v = match.group(1)
if v in var_seen:
rv = get_value_use(v)
else:
vars_seen.add('%' + v)
rv = get_value_definition(v)
return rv
for line in lines:
scrubbed_line = ...
new_ine = IRVALUE_RE.sub(ssaify, scrubbed_line)
...
```
I suspect that underneath, `_sre` is building the replacement string incrementally, so it won't be quadratic.
https://reviews.llvm.org/D28384
More information about the llvm-commits
mailing list