diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-10-31 13:42:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-31 13:42:14 -0700 |
commit | 119564e943fb47f081021d69a5456de8d051fe83 (patch) | |
tree | 5f37c851aa4e13c680722b63a0f916d700f89fdf /src/wasm-builder.h | |
parent | c8f1c1fc99905e286c15538957e24545a5c72536 (diff) | |
download | binaryen-119564e943fb47f081021d69a5456de8d051fe83.tar.gz binaryen-119564e943fb47f081021d69a5456de8d051fe83.tar.bz2 binaryen-119564e943fb47f081021d69a5456de8d051fe83.zip |
Optimize away copies through an if (#816)
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r-- | src/wasm-builder.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 4f3a80091..0f2c333f9 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -245,6 +245,7 @@ public: } // Additional utility functions for building on top of nodes + // Convenient to have these on Builder, as it has allocation built in static Index addParam(Function* func, Name name, WasmType type) { // only ok to add a param if no vars, otherwise indices are invalidated @@ -368,6 +369,11 @@ public: if (!isConcreteWasmType(curr->type)) return curr; return makeDrop(curr); } + + void flip(If* iff) { + std::swap(iff->ifTrue, iff->ifFalse); + iff->condition = makeUnary(EqZInt32, iff->condition); + } }; } // namespace wasm |