You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to zero (but -all -O2 can), thus misses an optimization opportunity.
Similar to #7455 and #7556, I think the probably cause is the limitation of merge-blocks, which cannot hoist the constant in the block out due to the load and store instructions cannot reordered. Below the is logic code checking whether a given binary operation emits zero bits:
if (!curr->type.isInteger() || Bits::getMaxBits(curr, this) != 0) {
returnnullptr;
}
auto zero = Builder(*getModule()).makeConst(Literal::makeZero(curr->type));
returngetDroppedChildrenAndAppend(curr, zero);
}
Currently the above logic cannot deduce the condition above to zero, since the getMaxBits does not handle the Block expression. Do you think there is a need to extend the getMaxBits to handle the Block?
The text was updated successfully, but these errors were encountered:
Do you think there is a need to extend the getMaxBits to handle the Block?
Yes, I think that makes sense to do.
It looks like getMaxBits does look through the value of a LocalSet, and it could look at other fallthrough values. That is, we can remove the handling of LocalSet, and use getFallthrough at the start of the function (to handle LocalSet and all other things).
(That will require a change to the getMaxBits API, since it will need the pass options and the module, to pass to getFallthrough. But that seems worthwhile.)
Given the following code:
wasm-opt (e6d02fa) by
-all -O3
cannot deduce the conditionto zero (but
-all -O2
can), thus misses an optimization opportunity.Similar to #7455 and #7556, I think the probably cause is the limitation of merge-blocks, which cannot hoist the constant in the block out due to the load and store instructions cannot reordered. Below the is logic code checking whether a given binary operation emits zero bits:
binaryen/src/passes/OptimizeInstructions.cpp
Lines 317 to 327 in e6d02fa
Currently the above logic cannot deduce the condition above to zero, since the
getMaxBits
does not handle theBlock
expression. Do you think there is a need to extend thegetMaxBits
to handle theBlock
?The text was updated successfully, but these errors were encountered: