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: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 24 Apr 2017 15:28:43 +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
Uroš Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-04-24
CC| |rguenth at gcc dot gnu.org
Component|other |tree-optimization
Ever confirmed|0 |1
--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Georg-Johann Lay from comment #6)
> > > The 2 last inline asms are missing the set of ESI.
> >
> > You should mark that "Some Code" asm clobbers %esi.
>
> Why? The code consumes ESI and is not set for that purpose.
>
> It's a condensed test case for a different target (avr) and demonstrates
> that it also occurs on x86.
>
> In general, we are striving for simpler test cases, nor more complicated
> ones, no?
Ah, I see the problem. The initialization value changes in each iteration.
Looks like a tree-optimization problem, _.optimized dump shows:
do_syscalls ()
{
register int reg __asm__ (*4);
register int reg __asm__ (*4);
<bb 2> [33.33%]:
reg = 0;
__asm__ __volatile__("/* Some Code %0 */" : : "r" reg);
reg = 1;
__asm__ __volatile__("/* Some Code %0 */" : : "r" reg);
__asm__ __volatile__("/* Some Code %0 */" : : "r" reg);
__asm__ __volatile__("/* Some Code %0 */" : : "r" reg);
return;
}
Confirmed, CC added.