> I don't know whether these operations should be part of the same SSA > optimization or not. #2 is more of a constant propagation kind of > thing I guess. #1 is the kind of thing that has made const-fold so > complicated. #1 is the important thing to add to the SSA optimizers, > isn't it?
Yes. In fact, i'm working on making GVN-PRE do some reassociation as part of it's value numbering in 4.1, so that we can detect that given a = b + c d = a + e and a = b + e d = a + c that d has the same value in both cases. This is more or less done through value expression chasing, rather than SSA_NAME_DEF_STMT chasing (because we already know the "value expression" for b + e, which is something like ValueNumber34 + ValueNumber65) > > nathan