RESOLVED FIXED 124869
Optimize away OR with zero - a common ASM.js pattern.
https://bugs.webkit.org/show_bug.cgi?id=124869
Summary Optimize away OR with zero - a common ASM.js pattern.
Nadav Rotem
Reported 2013-11-25 16:17:38 PST
Optimize away OR with zero - a common ASM.js pattern.
Attachments
Patch (1.37 KB, patch)
2013-11-25 16:17 PST, Nadav Rotem
no flags
Patch (1.37 KB, patch)
2013-11-25 16:20 PST, Nadav Rotem
no flags
Patch (1.84 KB, patch)
2013-11-25 22:58 PST, Nadav Rotem
no flags
Nadav Rotem
Comment 1 2013-11-25 16:17:55 PST
Nadav Rotem
Comment 2 2013-11-25 16:20:03 PST
Filip Pizlo
Comment 3 2013-11-25 16:56:01 PST
Comment on attachment 217844 [details] Patch This feels somewhat suboptimal - ideally we would allow for copy-propagation of y = (x|0), which this doesn't do. I recommend doing this in the FixupPhase instead. The way that you would do it is replace BitOr(x, 0) with Identity(x) ; Phantom(0). The Phantom(0) is relevant because want to know that the constant zero was live up to that point.
Nadav Rotem
Comment 4 2013-11-25 20:17:53 PST
I also thought that it would be a good idea to peephole it earlier. Should we also keep this one?
Filip Pizlo
Comment 5 2013-11-25 20:36:19 PST
(In reply to comment #4) > I also thought that it would be a good idea to peephole it earlier. Should we also keep this one? Nah - in fact what I would do is have: - An earlier peephole in FixupPhase. - A "later" peephole in MacroAssemblerBlah.h, where Blah = x86_64 | ARMv7 | ARM64. This would help the other JITs - including our regex JIT. ;-)
Nadav Rotem
Comment 6 2013-11-25 22:58:33 PST
WebKit Commit Bot
Comment 7 2013-11-26 09:07:26 PST
Comment on attachment 217864 [details] Patch Clearing flags on attachment: 217864 Committed r159783: <http://trac.webkit.org/changeset/159783>
WebKit Commit Bot
Comment 8 2013-11-26 09:07:28 PST
All reviewed patches have been landed. Closing bug.
Nadav Rotem
Comment 9 2013-11-26 15:40:44 PST
Filip, can we do this: void add32(TrustedImm32 imm, RegisterID dest) { if (imm.m_value) <---------- this add32(imm, dest, dest); } someone may be calling add32 just to use the flags. When is it safe to optimize code in the emitter ?
Note You need to log in before you can comment on or make changes to this bug.