Fix PR44281 (bad RA with global regs)

Bernd Schmidt
Fri Feb 19 22:03:00 GMT 2016

In this PR, we generate unnecessarily bad code for code that declares a 
global register var. Since global regs get added to fixed_regs, IRA 
never considers them as candidates. However, we do seem to have proper 
data flow information for them. In the testcase, the global reg dies, 
some operations are done on temporary results, and the final result 
stored back in the global reg. We can achieve the desired code 
generation by reusing the global reg for those temporaries.

Bootstrapped and tested on x86_64-linux. Ok? An argument could be made 
not to use this for gcc-6 since global register vars are both not very 
important and not very well represented in the testsuite.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: global-regalloc.diff
Type: text/x-patch
Size: 3189 bytes
Desc: not available
URL: <>

More information about the Gcc-patches mailing list