diff options
author | Alon Zakai <azakai@google.com> | 2019-09-18 15:14:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-18 15:14:23 -0700 |
commit | 3d7c4cfb41c4f34238dd6f42367747411ee6a478 (patch) | |
tree | 5125c49ead5a3fc7c2cbf892d2356157f34f447d /scripts/fuzz_opt.py | |
parent | 159e9a45877351f89af8ec0a05a7b3fe57d34aad (diff) | |
download | binaryen-3d7c4cfb41c4f34238dd6f42367747411ee6a478.tar.gz binaryen-3d7c4cfb41c4f34238dd6f42367747411ee6a478.tar.bz2 binaryen-3d7c4cfb41c4f34238dd6f42367747411ee6a478.zip |
Avoid fuzzing with multiple --flatten operations, which causes exponential overhead (#2345)
Diffstat (limited to 'scripts/fuzz_opt.py')
-rw-r--r-- | scripts/fuzz_opt.py | 7 |
1 files changed, 6 insertions, 1 deletions
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 |