On 12/16/2015 12:54 PM, Ajit Kumar Agarwal wrote:
/* If there is a call in the loop body, the call-clobbered registers
are not available for loop invariants. */
+
if (call_p)
available_regs = available_regs - target_clobbered_regs;
-
+
/* If we have enough registers, we should use them and not restrict
the transformations unnecessarily. */
if (regs_needed + target_res_regs <= available_regs)
return 0;
Just a thought, one thing that might make sense here is counting some of
the target_res_regs among the clobbered ones. This would become
int res_regs = target_res_regs;
if (call_p)
{
available_regs = available_regs - target_clobbered_regs;
res_regs /= 2;
}
/* If we have enough registers, we should use them and not restrict
the transformations unnecessarily. */
if (regs_needed + res_regs <= available_regs)
return 0;
It's all a bit crude, before and after, but such a change might be
justifiable.
Bernd