Two Hoopl questions

Jan Stolarek jan.stolarek at p.lodz.pl
Fri Jul 26 23:48:09 CEST 2013


Thank you Edward. I am aware of these requirements - my problem is writing the code in which these 
will always hold (I'm optimizing Cmm and hand-written Cmm files tend to cause many problems that 
don't appear in automatically generated Cmm). Having a debugging tool in form of Fuel would be 
helpful for me, because instead of getting a freeze and seeing no output from -ddump-cmm I would 
see incorrectly transformed Cmm that would allow me to track bugs more easily.

> > • The transfer function must be monotonic: given a more infor-
> > mative fact in, it must produce a more informative fact out.
I spent some considerable time thinking about this. Consider a simple example of copy propagation. 
Let's assume that { x = NAC }, i.e. we know that x has been defined earlier but is Not-A-Constant 
and so we cannot rewrite it. Now we have something llike this:

x := 3;
y := x;

Here we are allowed to rewrite y := x with y := 3, because after first statement we learn that { x 
= 3 }. Now consider this:

x := 3;
x := very_unsafe_stg_call();
y := x;

Here, after the first statement we learn that { x = 3 }, but after the second one we learn once 
again that x is NAC and so we are not allowed to rewrite statement y := x. So the value of x can 
change from NAC to a constant and from constant to a NAC. Is such a transfer function monotonic?

Janek




More information about the ghc-devs mailing list