On Tue, Jan 14, 2014 at 01:40:36PM +0000, Paulo Matos wrote: > Before I start to write code to reinvent the wheel, I would like to know if > there's something already out there to do context dependent expression > simplification. > What I need is to simplify an expression at a given point in a BB. > > For example: > > bb2: > r1 <- 2 > if r2 != 0 goto bb3 else bb4 > bb3: > r3 <- r2 << 1 > goto bb4 > bb4: > ... > ... > if ... goto bb4 else bb5 > > Is there any way already implemented to find the value of (and (plus r1 r3) > (const_int 1)) at the end of bb4 and simplify it to (const_int 0)?
VRP should handle this (of course at the GIMPLE level) performs context dependent optimizations through it's edge assertions. Jakub