Being able to mutate the graph in this way is important for other potential optimizations too, for example if we can determine that a block is never executed, removing it and turning its condition into a guard. (I have no idea how common that would be either, but it has potential to improve register allocation.)
-David On 07/16/2012 03:51 PM, Péricles Alves wrote: > Mike, I think that those blocks are not common in JavaScript programs. We > (me, Henrique and Igor Rafael) are working in a set optimizations and one > of them is Constant Propagation, which can leads to situations in which you > end up with unreachable code. > > On Mon, Jul 16, 2012 at 7:37 PM, Nicolas B. Pierron < > [email protected]> wrote: > >> Hi Henrique, >> >> I am happy to hear (read) that you are willing to play with IonMonkey. >> >> >> On 07/16/2012 01:35 PM, Henrique Santos wrote: >> >>> I am trying to implement an optimization in IonMonkey that consists in >>> removing unreachable basic blocks. However, I am having problems to >>> implement it, because I do not know how to update the phi-functions once I >>> remove a block. For instance, if I have this program: >>> >> >> Just by curiosity, what is your final project ? I don't think IonMonkey is >> producing headless basic block except for entry points. Removing dead >> basic block is something that we will need when we would have optimizations >> manipulating the graph. >> >> >> L0: >>> v0 = 0 >>> goto L2 >>> >>> L1: >>> v1 = 1 >>> >>> L2: >>> v2 = phi(v0, v1) >>> print v2 >>> >>> I want to eliminate L1, and then the program would be like: >>> >> >> Take care, you will need to ensure that the block you are trying to remove >> is not the OSR block created when we are compiling with canEnterAtBranch. >> >> -- >> Nicolas B. Pierron >> >> ______________________________**_________________ >> dev-tech-js-engine-internals mailing list >> dev-tech-js-engine-internals@**lists.mozilla.org<[email protected]> >> https://lists.mozilla.org/**listinfo/dev-tech-js-engine-**internals<https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals> >> > > > _______________________________________________ dev-tech-js-engine-internals mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

