| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
* Switch optimizations in remove-unused-brs: thread switch jumps, and turn a switch with all identical targets into a br
* refinalize in interm operations in remove-unused-brs, as we can be confused by it
|
| |
|
|
|
|
|
|
| |
* Moving blocks into if arms may change the block type, and the code we had was written under the assumption that was not true.
* Move block sinking merge-blocks => remove-unused-brs, as it's more natural there. that pass refinalizes everything anyhow
|
|
|
| |
Also fix broken tests surfaced by the new parser.
|
|
|
|
|
| |
(#1751)
partially solves #1676.
|
|
|
| |
This tries to reduce by replacing targets with the default, and by shrinking the list of targets.
|
|
|
|
| |
This yields more useful information when something goes wrong.
|
|
|
| |
If an if is enclosed in a block which is only used to exit one arm, move it into that arm, so it can be better optimized. Similar to what we did for loops in #1736.
|
|
|
|
| |
In this case we won't want generate any of the normal memory
helper functions (they come from the main module).
|
|
|
|
|
|
|
|
|
|
|
| |
Without this wasm-opt can't operation on emscripten-produced
SIDE_MODULES's which have zero sized memory imports.
Technically is not a validation failure if you have segments that
are larger than your initial memory, regardless of whether you
import them.
For non-imported memories it can be helpful though, so leaving it
in to catch those errors.
|
|
|
|
|
| |
Rely on the dedicated pass for that. It's not worth the extra complexity to try, as we can't easily handle all the cases anyhow.
Add another run of the dedicated name-removing pass in the default passes.
|
|
|
|
| |
`strpbrk` segfaults when `name.str` is nullptr, so check first.
|
|
|
|
| |
* move a loop exit block (block with a name, and one child which is the loop) into the loop in MergeBlocks, as that is better for other passes
|
|
|
|
|
| |
Not at all sure why we're seeing any there, but it's easy enough to
handle that we might as well.
|
|
|
| |
We previously had code to recreate an if from a block+branch when possible, but not when the block had a return value. This PR adds support to restructure that too, into an if with a value.
|
|
|
|
| |
do it properly later (#1744)
|
|
|
|
|
|
|
| |
Handle a corner case in ReFinalize, which incrementally re-types code after changes. The problem is that if we need to figure out the type of a block, we look to the last element flowing out, or to breaks with values. If there is no such last element, and the breaks are not taken - they have unreachable values - then they don't tell us the block's proper type. We asserted that in such a case the block still had a type, and didn't handle this.
To fix it, we could look on the parent to see what type would fit. However, it seem simpler to just remove untaken breaks/switches as part of ReFinalization - they carry no useful info anyhow. After removing them, if the block has no other signal of a concrete type, it can just be unreachable.
This bug existed for at least 1.5 years - I didn't look back further. I think it was noticed by the fuzzer now due to recent fuzzing improvements and optimizer improvements, as I just saw this bug found a second time.
|
|
|
|
| |
This writes the data section into a file suitable for use with emscripten's
--memory-init-file flag
|
|
|
| |
Use c++11 auto, iterators, etc.
|
|
|
| |
Necessary for simd, as we add a type with alignment >8. We were just broken on that before this PR.
|
|
|
|
|
|
| |
* Recombine function pieces after randomly generating them, by creating copies and moving them around. This gives a realistic probability to seeing duplicate expressions, which some optimizations look for, which otherwise the fuzzer would have almost never reached.
* Mutate function pieces after recombination, giving not only perfect duplicates but also near-duplicates.
These operations take into account the type, but not the nesting and uniqueness of labels, so we fix that up afterwards (when something is broken, we replace it with something trivial).
|
|
|
| |
For souper we need to flip some operations in DataFlow IR, since souper doesn't have any redundant ones. But we flipped not just left and right but also equal/not equal, which was wrong.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a block has code after an unreachable element, it makes merging to an outer block tricky - the child block may be unreachable, but the parent have a return type,
(block (result i32)
..
(block
(unreachable)
(nop)
)
)
It's ok to end an unreachable block with a nop, but not a typed one.
To avoid this, if a child block has dce-able code, just ignore it.
|
|
|
|
|
|
|
| |
We create some fake nodes for internal use, and were looking at one by mistake. This fixes that by
* Creating a non-ambiguous fake node, a call (which represents an unknown value properly, unlike a zero which we had before).
* Make DFO not rely on those values, if it knows a node is constant, apply those constant values.
Found by the fuzzer.
|
|
|
|
|
| |
We need to verify that the reordering is valid if there are side effects.
Original bug report: https://groups.google.com/forum/?nomobile=true#!topic/emscripten-discuss/HIlGf8o2Ato
|
|
|
|
|
| |
Not being able to evaluate a ctor is different to that ctor
being absent. This is masked a bug in emscripten where we
were spelling the names of the ctors wrong on the command line.
|
| |
|
|
|
| |
Follow-up to #1717
|
|
|
|
|
|
| |
fixes kripken/emscripten#1718
The way fastcomp emits compareExchange is a little odd, we just need to ignore the shift.
|
|
|
|
|
| |
This was causing a deadlock while destroying the thread pool.
|
|
|
|
|
|
|
|
|
| |
This new pass minifies import and export names, for example, this may minify
(import "env" "longname" (func $internal))
to
(import "env" "a" (func $internal))
By updating the JS that provides those imports/calls those exports, we can use the minified names properly. This can save a useful amount of space in the wasm and JS, see kripken/emscripten#7414
|
|
|
|
|
| |
That is the correct order in the text format, wabt errors otherwise.
See AssemblyScript/assemblyscript#310
|
|
|
| |
Related to #1716 (comment)
|
| |
|
|
|
|
| |
actual support) (#1711)
|
| |
|
|
|
| |
This fixes asm2wasm parsing of the max to allow 4GB, and also changes the internal Memory::kMaxValue values to reflect that. We used to use kMaxValue to also represent "no limit", so I split that out into kUnlimitedValue.
|
|
|
|
| |
(#1696)
|
| |
|
| |
|
|
|
|
|
| |
SafeHeap was emitting them, but it looks like they are invalid according to the wasm-threads spec.
Fixes kripken/emscripten#7208
|
| |
|
|
|
| |
While debugging to fix the waterfall regressions I noticed that wasm-reduce regressed. We need to be more careful with visitFunction which now may visit an imported function - I found a few not-well-tested passes that also regressed that way.
|
|
|
| |
Fixes the 3 regressions mentioned in a comment on #1678
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #1649
This moves us to a single object for functions, which can be imported or nor, and likewise for globals (as a result, GetGlobals do not need to check if the global is imported or not, etc.). All imported things now inherit from Importable, which has the module and base of the import, and if they are set then it is an import.
For convenient iteration, there are a few helpers like
ModuleUtils::iterDefinedGlobals(wasm, [&](Global* global) {
.. use global ..
});
as often iteration only cares about imported or defined (non-imported) things.
|
|
|
|
|
|
|
| |
The current patch:
* Preserves the debug locations from function prolog and epilog
* Preserves the debug locations of the nested blocks
|
|
|
|
| |
(#1681)
|
|
|
|
| |
* call_import is not lightweight for inlining purposes - we had call but not callimport, which is even less light
|
|
|
|
|
|
|
|
|
|
|
|
| |
* show a proper error for an empty asm2wasm input
* handle end of input in processExpressions in binary reading
* memory segment sizes should be unsigned
* validate input in wasm-ctor-eval
* update tests
|