Context dependent expression simplification
Hello, 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)? Cheers, Paulo Matos
Re: Context dependent expression simplification
On Tue, Jan 14, 2014 at 01:40:36PM +, 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
RE: Context dependent expression simplification
-Original Message- From: Jakub Jelinek [mailto:ja...@redhat.com] Sent: 14 January 2014 13:45 To: Paulo Matos Cc: gcc@gcc.gnu.org Subject: Re: Context dependent expression simplification On Tue, Jan 14, 2014 at 01:40:36PM +, 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. I need to do this during loop_doloop to simplify infinite conditons. Might have to implement something to do this at RTL level then. Paulo Matos Jakub