An ICE occurs in iv_analyze_def because the register referred to by a def is
not the same register referred to by the set in an rtx.  The rtx in question
actually has multiple set's, but single_set only returns one of them because of
a stale REG_UNUSED note.

The stale REG_UNUSED note is created in gcse.  At the beginning of gcse, the
REG_UNUSED note is added (and is correct).  At the end of gcse, if expensive
optimizations are on, it will make a call to cse_main which will merge two defs
with the same expression.  This makes the REG_UNUSED note stale, however it is
not removed from the operation.  Later in iv_analyze_def, the call to
single_set trips over this stale REG_UNUSED note.  I have verified that the
problem is resolved if df_analyze (with the notes problem added) corrects the
stale note and avoids the problem.  However discussions with Ian suggest that
this might not be the correct approach to fixing the problem, so I'm filing
this bug.

I've attached a test case which will cause the ICE if compiled with the
following command line:

gcc -c -O2 -fprofile-use test.c

Note that no .gcda file is necessary.


-- 
           Summary: ICE in iv opts caused by stale REG_UNUSED note
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nvachhar at google dot com
  GCC host triplet: i686-unknown-linux
GCC target triplet: x86_64-unknown-linux


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

Reply via email to