Closed
Bug 1123874
Opened 10 years ago
Closed 10 years ago
Optimize MoveGroups with multiple targets for the same source
Categories
(Core :: JavaScript Engine: JIT, defect)
Tracking
()
RESOLVED
FIXED
mozilla38
People
(Reporter: bhackett1024, Assigned: bhackett1024)
References
Details
Attachments
(1 file)
4.67 KB,
patch
|
sunfish
:
review+
|
Details | Diff | Splinter Review |
Sometimes, the register allocator generates move groups which move the same source to multiple different targets. This seems to happen a lot more often with the backtracking allocator than with LSRA, probably because the backtracking allocator has the flexibility to represent a vreg in multiple locations at once.
The move resolver doesn't try to optimize these moves at all though, and we end up generating dumb code like:
[MoveGroup]
movl 0xc0(%esp), %esi
push 0xc0(%esp)
pop 0x8c(%esp)
This appears in a hot loop in octane-mandreel on x86.
The attached patch improves the move resolver to look for moves with the same source, where that source is in memory and one of the targets is a register. It then fiddles with the moves so that we end up with code for the above like:
[MoveGroup]
movl 0xc0(%esp), %esi
movl %esi, 0x8c(%esp)
On x86 with the backtracking allocator, this improves my octane-mandreel score from 25k to 28k. LSRA is 30k.
Even before this patch, backtracking generates code with fewer MoveGroup instructions (19% of total executed instructions vs. 21% for LSRA). However, I think that memory->memory moves like the push/pop instructions above are poisonous for performance. Before this patch the backtracking allocator generated more than 10 times as many of these memory push/pop instructions as LSRA. This patch removes more than half of them but there is still work to be done in minimizing these (either by more MoveGroup optimizations or by improving the allocator itself).
Attachment #8551984 -
Flags: review?(sunfish)
Comment 1•10 years ago
|
||
Comment on attachment 8551984 [details] [diff] [review]
patch
Review of attachment 8551984 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jit/MoveResolver.cpp
@@ +191,5 @@
> + !existing.isCycleEnd())
> + {
> + MoveOp *after = (size_t(i + 1) < orderedMoves_.length())
> + ? &orderedMoves_[i + 1]
> + : orderedMoves_.end();
I think this would be easier to read as "orderedMoves_.begin() + i + 1", but either way is ok with me.
Attachment #8551984 -
Flags: review?(sunfish) → review+
Assignee | ||
Comment 2•10 years ago
|
||
Assignee: nobody → bhackett1024
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in
before you can comment on or make changes to this bug.
Description
•