Hi, On Mon, 7 Sep 2015, Kugan wrote:
> For the following testcase (compiling with -O1; -O2 works fine), we have > a stmt with stm_code SSA_NAME (_7 = _ 6) and for which _6 is defined by > a GIMPLE_CALL. In this case, we are using wrong SUNREG promoted mode > resulting in wrong code. And why is that? > Simple SSA_NAME copes are generally optimized > but when they are not, we can end up using the wrong promoted mode. > Attached patch fixes when we have one copy. I think it's the wrong place to fixing up. Where does the wrong use come from? At that place it should be fixed, not after the fact. > _6 = bar5 (-10); > ... > _7 = _6; > _3 = (long unsigned int) _6; > ... > if (_3 != l5.0_4) There is no use of '_7' in this snippet so I don't see the relevance of SUBREG_PROMOTED_MODE on it. But whatever you do, please make sure you include the testcase for the problem as a regression test: > extern void abort (void); > > __attribute__ ((noinline)) > static unsigned short int foo5 (int x) > { > return x; > } > > __attribute__ ((noinline)) > short int bar5 (int x) > { > return foo5 (x + 6); > } > > unsigned long l5 = (short int) -4; > > int > main (void) > { > if (bar5 (-10) != l5) > abort (); > return 0; > } Ciao, Michael.