[Bug tree-optimization/80492] [5/6/7 Regression] Wrong code when unrolling a loop with inline asm and local regs

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Tue Apr 25 08:46:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80492

--- Comment #13 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 25 Apr 2017, ubizjak at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80492
> 
> --- Comment #12 from Uroš Bizjak <ubizjak at gmail dot com> ---
> (In reply to Richard Biener from comment #10)
> > But I really wonder if it is ok to omit constraints from the asm marking
> > the register variable as changed.
> 
> The register is not changed in the asm, please note that the testcase
> intentionally changes the value of the register before each asm.

Yes.  See my followup comment.  Would removing the redundant set
be ok if it were storing the same value each time?

Thus optimizing

  reg = 0;
  __asm__ __volatile__("/* Some Code %0 */" :  : "r" reg);
  reg = 0;
  __asm__ __volatile__("/* Some Code %0 */" :  : "r" reg);
  reg = 0;
  __asm__ __volatile__("/* Some Code %0 */" :  : "r" reg);
  reg = 0;
  __asm__ __volatile__("/* Some Code %0 */" :  : "r" reg);

to

  reg = 0;
  __asm__ __volatile__("/* Some Code %0 */" :  : "r" reg);
  __asm__ __volatile__("/* Some Code %0 */" :  : "r" reg);
  __asm__ __volatile__("/* Some Code %0 */" :  : "r" reg);
  __asm__ __volatile__("/* Some Code %0 */" :  : "r" reg);

?


More information about the Gcc-bugs mailing list