From 3d7c4cfb41c4f34238dd6f42367747411ee6a478 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 18 Sep 2019 15:14:23 -0700 Subject: Avoid fuzzing with multiple --flatten operations, which causes exponential overhead (#2345) --- scripts/fuzz_opt.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts/fuzz_opt.py') diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py index 4591b4150..20676f70e 100644 --- a/scripts/fuzz_opt.py +++ b/scripts/fuzz_opt.py @@ -511,7 +511,11 @@ def get_multiple_opt_choices(): ret = [] # core opts while 1: - ret += random.choice(opt_choices) + choice = random.choice(opt_choices) + if '--flatten' in ret and '--flatten' in choice: + print('avoiding multiple --flatten in a single command, due to exponential overhead') + else: + ret += choice if len(ret) > 20 or random.random() < 0.3: break # modifiers (if not already implied by a -O? option) @@ -520,6 +524,7 @@ def get_multiple_opt_choices(): ret += ['--optimize-level=' + str(random.randint(0, 3))] if random.random() < 0.5: ret += ['--shrink-level=' + str(random.randint(0, 3))] + assert ret.count('--flatten') <= 1 return ret -- cgit v1.2.3