diff options
author | JF Bastien <jfb@chromium.org> | 2016-02-05 05:11:50 -0800 |
---|---|---|
committer | JF Bastien <jfb@chromium.org> | 2016-02-05 05:11:50 -0800 |
commit | 7459e5af01fbe3a8e75e73783794b4cdffda34e9 (patch) | |
tree | aae2c28eb1cc465a4582208d6c713584a51a1bcf /src/wasm.h | |
parent | 8f67b6e27a38c93fbca7f3c44a88889b3896952f (diff) | |
download | binaryen-7459e5af01fbe3a8e75e73783794b4cdffda34e9.tar.gz binaryen-7459e5af01fbe3a8e75e73783794b4cdffda34e9.tar.bz2 binaryen-7459e5af01fbe3a8e75e73783794b4cdffda34e9.zip |
Fix select
The ordering changed in: https://github.com/WebAssembly/spec/pull/221
Which changed the spec tests, breaking sexpr-wasm because it pulls in the spec tests. This was then fixed:
https://github.com/WebAssembly/sexpr-wasm-prototype/commit/23dc368148fc7827a603e3853f5a40287eb9effe
Which in turn breaks when binaryen feeds sexpr-wasm .wast files with the old select operand ordering.
Note that this PR has new failures when running the torture tests in binaryen-shell: the order of evaluation is correct in binaryen-shell but isn't emitted properly by LLVM in the .s files. This will require another patch to fix LLVM.
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wasm.h b/src/wasm.h index b9d0d6822..893c777c4 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -911,15 +911,15 @@ class Select : public Expression { public: Select() : Expression(SelectId) {} - Expression *condition, *ifTrue, *ifFalse; + Expression *ifTrue, *ifFalse, *condition; std::ostream& doPrint(std::ostream &o, unsigned indent) { o << '('; prepareColor(o) << printWasmType(type) << ".select"; incIndent(o, indent); - printFullLine(o, indent, condition); printFullLine(o, indent, ifTrue); printFullLine(o, indent, ifFalse); + printFullLine(o, indent, condition); return decIndent(o, indent); } @@ -1447,9 +1447,9 @@ struct ChildWalker : public WasmWalkerBase<ChildWalker<ParentType>> { parent.walk(curr->right); } void visitSelect(Select *curr) { - parent.walk(curr->condition); parent.walk(curr->ifTrue); parent.walk(curr->ifFalse); + parent.walk(curr->condition); } void visitReturn(Return *curr) { parent.walk(curr->value); |