Open Bug 733661 Opened 13 years ago Updated 3 years ago

IonMonkey: LICM should sink instructions if they're only used after the loop

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: rpearl, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [ion:t])

Looking at other implementations of LICM (I happen to be doing this for a class and have been working with LLVM's implementation), I think it would be useful for Ionmonkey to sink instructions to the exit node of the loop. This means that if execution terminates inside the loop, we can avoid running these computations. In any case, if licm is run, it is no more expensive to sink than to hoist.
IonMonkey uses resume point to fallback to the interpreter, which means you cannot sink an instruction after a resume point which is catching your instruction result to fallback to the interpreter.  When you have a conditional path, we create 2 basic block and each basic block has a resume point at its beginning.  So, the value you want to sink is captured by a resume point, and if it is not this implies that it was unused and it would be removed if it has no side effect.

If you really want to solve this problem in IonMonkey, then we would need to have delayed computation in resume points and this will only work if you can ensure that the set of instructions that you sink has no side effect and no bailout to any previous resume point.
Assignee: general → nobody

This work can actually be done today in the way described in comment 1, as we now have Recover Instruction capable of expressing small computations as part of Resume Points, in case a bailout were to occur between the location where the instruction is expected and the location where the instruction is moved to.

Severity: normal → --
Type: defect → enhancement
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.