https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80492
--- Comment #14 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to rguent...@suse.de from comment #13) > 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); > > ? This is OK, asm needs explicit clobber if it clobbers a register.