This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/80492] [5/6/7 Regression] Wrong code when unrolling a loop with inline asm and local regs
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 25 Apr 2017 08:46:37 +0000
- Subject: [Bug tree-optimization/80492] [5/6/7 Regression] Wrong code when unrolling a loop with inline asm and local regs
- Auto-submitted: auto-generated
- References: <bug-80492-4@http.gcc.gnu.org/bugzilla/>
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);
?