On Dec 6, 2012, Richard Biener <richard.guent...@gmail.com> wrote: > On Tue, Nov 6, 2012 at 1:54 AM, Easwaran Raman <era...@google.com> wrote: >> I am unable to figure out the right way to handle the debug >> statements. What I tried was to find debug statements that use the SSA >> name defined by the statement I moved (using SSA_NAME_IMM_USE_NODE) >> and then moved them as well at the right place. Thus, if I have to >> move t1 = a + b down (after the definition of 'd'), I also moved all >> debug statements that use t1 after the new position of t1. That still >> caused use-before-def problems in ssa_verify. I noticed that the debug >> statements got modified behind the scenes causing these issues. Any >> hints on what is the right way to handle the debug statements would be >> very helpful.
> I think you cannot (and should not) move debug statements. Yup. If you must move a DEF past a debug stmt that USEs it, resetting the debug stmt is a (poor) option, but inserting a debug temp bound to the expression moved down, and replacing the use in the debug stmt with a use of the debug temp. I.e., given: x_? = <expr> # DEBUG y => x_? ... change that to: # DEBUG T.?? => <expr> # DEBUG y => T.?? ... x_? = <expr> -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist Red Hat Brazil Compiler Engineer