Skip to content

Commit

Permalink
Merge pull request #543 from WebAssembly/fix-merge-blocks
Browse files Browse the repository at this point in the history
Fix merge blocks on named blocks
  • Loading branch information
kripken committed May 26, 2016
2 parents 948f6fe + 5b6918e commit 45618dd
Show file tree
Hide file tree
Showing 6 changed files with 458 additions and 541 deletions.
3 changes: 2 additions & 1 deletion auto_update_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
if t.endswith('.wast'):
print '..', t
passname = os.path.basename(t).replace('.wast', '')
cmd = [os.path.join('bin', 'binaryen-shell'), ('--' + passname if passname != 'O' else '-O'), os.path.join('test', 'passes', t), '--print']
opts = ['-O'] if passname == 'O' else ['--' + p for p in passname.split('_')]
cmd = [os.path.join('bin', 'binaryen-shell')] + opts + [os.path.join('test', 'passes', t), '--print']
print ' ', ' '.join(cmd)
actual, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
open(os.path.join('test', 'passes', passname + '.txt'), 'w').write(actual)
Expand Down
4 changes: 2 additions & 2 deletions check.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ def minify_check(wast, verify_final_result=True):
if t.endswith('.wast'):
print '..', t
passname = os.path.basename(t).replace('.wast', '')
opt = '-O' if passname == 'O' else '--' + passname
cmd = [os.path.join('bin', 'binaryen-shell'), opt, os.path.join('test', 'passes', t), '--print']
opts = ['-O'] if passname == 'O' else ['--' + p for p in passname.split('_')]
cmd = [os.path.join('bin', 'binaryen-shell')] + opts + [os.path.join('test', 'passes', t), '--print']
actual = run_command(cmd)
fail_if_not_identical(actual, open(os.path.join('test', 'passes', passname + '.txt')).read())

Expand Down
2 changes: 1 addition & 1 deletion src/passes/MergeBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct MergeBlocks : public WalkerPass<PostWalker<MergeBlocks, Visitor<MergeBloc
if (dependency1 && *dependency1 && EffectAnalyzer(*dependency1).hasSideEffects()) return outer;
if (dependency2 && *dependency2 && EffectAnalyzer(*dependency2).hasSideEffects()) return outer;
if (auto* block = child->dynCast<Block>()) {
if (block->list.size() >= 2) {
if (!block->name.is() && block->list.size() >= 2) {
child = block->list.back();
if (outer == nullptr) {
// reuse the block, move it out
Expand Down
Loading

0 comments on commit 45618dd

Please sign in to comment.