Open Bug 733661 Opened 9 years ago Updated 7 years ago
Monkey: LICM should sink instructions if they're only used after the loop
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.
You need to log in before you can comment on or make changes to this bug.