This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-fprofile-arcs overwriting return value of fn.
- From: Johannes Thoma <joe at mond dot at>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 25 Apr 2002 18:25:20 +0200
- Subject: -fprofile-arcs overwriting return value of fn.
Hi all,
I was experimenting with -fprofile-arcs on the new-reg-alloc branch.
I found that on exit edges, it inserts insns for profilling after
the ``use'' of the register holding the return value which can
cause return values be overwritten:
(insn 18 14 21 (set (reg/i:SI 0 eax)
(reg:SI 58)) -1 (nil)
(nil))
;; Instrumentation code should go here...
(insn 21 18 26 (use (reg/i:SI 0 eax)) -1 (nil)
(nil))
;; This is inserted by -fprofile-arcs.
(insn 26 21 28 (set (reg:SI 60)
(symbol_ref:SI ("*.LPBX2"))) -1 (nil)
(expr_list:REG_EQUAL (symbol_ref:SI ("*.LPBX2"))
(nil)))
(insn 28 26 0 (parallel[
(set (mem:DI (reg:SI 60) 0)
(plus:DI (mem:DI (reg:SI 60) 0)
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
] ) -1 (nil)
(nil))
;; End of basic block 0, registers live:
(nil)
Register allocator then assigns eax to pseudo reg 60 causing return
value be overwritten.
I wrote a quick patch that searches ``use'' insns back for all exit
edges and inserts instrumentation code *before* the use insn ..
(it doesn't bootstrap yet.), where to send it when it is ready?
Or is it better to fix flow analysis (such that the ``use'' insn doesn't
belong to basic block any more)?
Did anybody else observe the above? Is someone already working on
a patch?
Thanks for any info (I am new to gcc mailing list and might ask
stupid questions ..)
- Johannes
--
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.3ia
mQENAzqRc0kAAAEIALmrO8ORXopz3etEcHZttJSjCcn5OzqQcTIEFI2E9H2Kt/CQ
QxVDkLQfIhC+j8eVSk6tYDRGhbJOb6SS6dp8oinLIxJqxauDgwaO6hPBpEV+plOG
1GWXwzlYn8OeeN2A50GM6EjaSSLKAl7SQTSNonpAbNmy6BZCL0ySiM4FwWIZzBRD
fbvtj2jNeu3Yc1Z5t1WrXn5QjbPkB/E5Py7sE9PqcHhQQG4RBQ5n5Bf7qw8osB/n
+354OBXo/E5V/ksO8ykmHNwIK7+/hXZ65tSC2EYyMMNkn8SrpWyhBhqphStyi0Q5
mgQXyXBQfpsce/E/R8YKZ0T8tf6q82uF48eULUUABRG0HEpvaGFubmVzIFRob21h
IDxqb2VAbW9uZC5hdD6JARUDBRA6kXNJ82uF48eULUUBAZcbB/9rhYDvHmJICrJ9
G5WEY/acu9LmYu70I3k2ILuJB/F8we7FY5H4sOCaWHfAin3hRuRsX4rVa9AkCGQj
bY1b/PxL9e6+LMyQB2Bif58rC24OHAg6VCYe5SQaoVcaHDl+yI5KFwtCBbjYYShh
fnw9CliYYbVBki0w9xQNcIjXW/FDlwPFb2PQ+ZUjBCqwuFrCtSS0m4Izx326xH+z
DRwH6ix2GEhYHSO+Uk7u9AEHLYe3qSPAcIqiDVpud7HYOSsRAkDs+c1y8CLeD7Jn
pnK6xE/2tsCO8qAuVWGaKbb9ImMcogGwZQ5Fj9wAJakUeAiWtgHuJ9UlX8spRVdc
7T4lu0GK
=bYXX
-----END PGP PUBLIC KEY BLOCK-----