There are two separate root causes for the problem reported in PR
57393. This patch attempts to fix both.

First is due to newly created stmts that have the default UID of 0
which are compared with statements with valid UIDs leading to broken
dependences. As discussed in an earlier thread, I check the UIDs
before using them and ensure stmts have a valid UID. In the worst
case, this reassigns UIDs for the entire BB containing the stmts in
question.

The second is due to debug stmts being out of sync with the IR after
reassociation. I think the right fix is to create debug temps before
actual reassociation to decouple them from the SSA variables involved
in reassociation.

This bootstraps in x86_64 and I am running the tests. Ok for trunk?

Thanks,
Easwaran

2013-09-16  Easwaran Raman  <era...@google.com>

        PR middle-end/57393
        * tree-ssa-reassoc.c (get_stmt_uid_with_default): Remove.
        (build_and_add_sum): Do not set UID of newly created statements.
        (ensure_valid_uid): New function,
        (find_insert_point): called here before UIDs are compared.
        (insert_stmt_after): Do not reset debug statements.
        (regenerate_debug_stmts): New function,
        (reassociate_bb): use here.

testsuite/ChangeLog:
2013-09-16  Easwaran Raman  <era...@google.com>

        PR middle-end/57393
        * gcc.dg/tree-ssa/reassoc-32.c: New testcase.
        * gcc.dg/tree-ssa/reassoc-33.c: New testcase.
        * gcc.dg/tree-ssa/reassoc-34.c: New testcase.

Attachment: pr57393.patch
Description: Binary data

Reply via email to