public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/44013]  New: VTA produces wrong code
@ 2010-05-06 12:57 hariharans at picochip dot com
  2010-05-06 13:00 ` [Bug rtl-optimization/44013] " hariharans at picochip dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: hariharans at picochip dot com @ 2010-05-06 12:57 UTC (permalink / raw)
  To: gcc-bugs

I first found this bug in GCC 4.5.0, but it is repeatable in mainline as of
159067. The attached preprocessed testcase, when compiled using "-O2 -S" will
show the problem.

We have a basic block [bb 3] with the following piece of code.

[32] X(SI) = unspec_volatile (const_int 3)
[33] var_location (some_var) = X
[34] (subreg:SI (reg:DI Z) 0) = X
...
[41] Y(SI) = unspec_volatile (const_int 3)
[42] var_location (some_var) = Y
[43] (subreg:SI (reg:DI Z) 4) = Y

Combine combines 32->34 and 41->43 and  converts this into

[33] var_location (some_var) = unspec_volatile (const_int 3)
[34] (subreg:SI (reg:DI Z) 0) = unspec_volatile (const_int 3)
...
[42] var_location (some_var) = unspec_volatile (const_int 3)
[43] (subreg:SI (reg:DI Z) 4) = unspec_volatile (const_int 3

I am not sure if this is a valid transformation in itself. var_location debug
instructions now dont just use registers, but they have unspec_volatile which
is assumed to clobber all register/memory.

The scheduler dependency for this becomes 34->42->43 since the debug_insn in 42
actually clobbers everything. But, when scheduling instructions we ignore the
debug_insn in 42 and hence the dependency is broken. 34 and 43 are both deemed
ready, but 43 gets scheduled first which results in the two unspec_volatile
instructions being reordered.

I am not sure which of the steps above is incorrect. Any pointers on this would
be greatly appreciated.

Please let me know if you need any information.

Thanks
Hari


-- 
           Summary: VTA produces wrong code
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hariharans at picochip dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: picochip-unknown-none


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44013


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-06-09  4:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-06 12:57 [Bug rtl-optimization/44013] New: VTA produces wrong code hariharans at picochip dot com
2010-05-06 13:00 ` [Bug rtl-optimization/44013] " hariharans at picochip dot com
2010-05-06 13:07 ` jakub at gcc dot gnu dot org
2010-05-06 14:02 ` hariharans at picochip dot com
2010-05-06 14:04 ` hariharans at picochip dot com
2010-05-06 14:05 ` hariharans at picochip dot com
2010-05-06 14:06 ` hariharans at picochip dot com
2010-06-02  5:09 ` aoliva at gcc dot gnu dot org
2010-06-02  5:19 ` aoliva at gcc dot gnu dot org
2010-06-02  8:41 ` hariharans at picochip dot com
2010-06-04 16:44 ` jakub at gcc dot gnu dot org
2010-06-07  7:16 ` [Bug rtl-optimization/44013] [4.5 Regression] " jakub at gcc dot gnu dot org
2010-06-09  4:54 ` aoliva at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).