summaryrefslogtreecommitdiff
path: root/testsuite/driver/testlib.py
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2021-11-12 15:45:18 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-23 01:07:29 -0500
commit680ef2c8eafa102d8ed5866d5ccf2872f5d0f269 (patch)
tree3929d4f6d120b779b9e0cbb2551a37091948c38e /testsuite/driver/testlib.py
parent68a3665a73c2a41820587be5a79674321d0793a0 (diff)
downloadhaskell-680ef2c8eafa102d8ed5866d5ccf2872f5d0f269.tar.gz
CmmSink: Be more aggressive in removing no-op assignments.
No-op assignments like R1 = R1 are not only wasteful. They can also inhibit other optimizations like inlining assignments that read from R1. We now check for assignments being a no-op before and after we simplify the RHS in Cmm sink which should eliminate most of these no-ops.
Diffstat (limited to 'testsuite/driver/testlib.py')
-rw-r--r--testsuite/driver/testlib.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index efeaa94b89..d4c8fc38f7 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -800,9 +800,26 @@ def check_errmsg(needle):
return "%s not contained in -ddump-simpl\n" % needle
return normalise_errmsg_fun(norm)
-def grep_errmsg(needle):
- def norm(str):
- return "".join(filter(lambda l: re.search(needle, l), str.splitlines(True)))
+# grep_errmsg(regex,[match_only])
+# If match_only = True we only check the part of the error
+# that matches the regex.
+def grep_errmsg(needle:str, match_only = False):
+
+ def get_match(str:str):
+ m = re.search(needle,str)
+ if m:
+ return m.group(0)
+ else:
+ return None
+
+ def norm(str) -> str:
+ if not match_only:
+ return "".join( filter(lambda l: re.search(needle,l),
+ str.splitlines(True)))
+ else:
+ matches = [get_match(x) for x in str.splitlines(True)]
+ res = "\n".join([x for x in matches if x])
+ return res
return normalise_errmsg_fun(norm)
def multiline_grep_errmsg(needle):