For example, the Trunc value in B3 is really just an identity in Air. Currently we emit a Move. But, it would be more efficient to copy propagate: just set the tmp of the Trunc to the tmp of the input.
We could do similar things for ZExt and SExt. For ZExt, we could record if the tmp for the input value was produced by an instruction that already zero-extends. For SExt, we could record if the tmp for the input value was produced by an instruction that already sign-extends. For both of them, we could also use an analysis of whether the input is non-negative. If so, the we could copy-propagate through ZExt and SExt provided that the source either zero- or sign-extended. For example, we could copy-prop through a SExt if the source zero-extended and the value is proved non-negative.
Interestingly though, we may not need to do anything special for SExt. The FTL is already smart enough to use ZExt in all those cases where the input is non-negative.
Created attachment 264709 [details]
Created attachment 264710 [details]
Comment on attachment 264710 [details]
Landed in http://trac.webkit.org/changeset/191977