Closed Bug 866670 Opened 11 years ago Closed 11 years ago

IonMonkey: Fold unnecessary bitops after analyzing truncated instructions

Categories

(Core :: JavaScript Engine, defect)

Other Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: bhackett1024, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
Right now, unnecessary bitops like (x | 0) on an integer input are folded away during GVN.  This happens before range analysis though, and as a result information about the truncation is lost and operations like ((x + y) | 0) will usually require unnecessary overflow checks.

Folding unnecessary bitops seems to fit a different role than constant folding / CSE; this patch makes this step part of range analysis, done after instructions are marked as truncated.
Attachment #743036 - Flags: review?(jdemooij)
Comment on attachment 743036 [details] [diff] [review]
patch

Review of attachment 743036 [details] [diff] [review]:
-----------------------------------------------------------------

A similar pattern is ~~x; maybe BitNot should have the same treatment?

Does this have any effect on Octane-mandreel?

::: js/src/ion/MIR.cpp
@@ +878,5 @@
>  
>      if (IsConstant(rhs, -1))
>          return foldIfNegOne(1);
>  
> +    if (EqualValues(false, lhs, rhs))

Can we move this call to foldsTo, and s/false/useValueNumbers?
Attachment #743036 - Flags: review?(jdemooij) → review+
I kept the EqualValues in foldUnnecessaryBitop(), as an (x | x) is doing conceptually the same thing as an (x | 0) and removing it in foldsTo() will cause the same problem that this bug is fixing.

https://hg.mozilla.org/integration/mozilla-inbound/rev/d53be0e3442d
https://hg.mozilla.org/mozilla-central/rev/d53be0e3442d
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: