------- Comment #8 from ebotcazou at gcc dot gnu dot org 2010-06-11 20:34
-------
> [...@gnu-12 gcc]$ ./xgcc -B./ -O
> /export/gnu/import/svn/gcc-test/src-trunk/gcc/testsuite/gcc.dg/pr42461.c
> /tmp/ccmdb99H.o: In function `main':
> pr42461.c:(.text+0x22): undefined reference to `link_failure'
> collect2: ld returned 1 exit status
> [...@gnu-12 gcc]$ ./xgcc -B./ -O2
> /export/gnu/import/svn/gcc-test/src-trunk/gcc/testsuite/gcc.dg/pr42461.c
> [...@gnu-12 gcc]$
At -O we run only a stand-alone DCE pass after reload, which is also after at
least one splitting pass. Now the ia64 back-end splits calls and this drops
the RTL_PURE_CALL_P flag. There is a comment about this in ia64.md:
;; Irritatingly, we don't have access to INSN within the split body.
;; See commentary in ia64_split_call as to why these aren't peep2.
(define_split
[(call (mem (match_operand 0 "call_operand" ""))
(const_int 1))
(clobber (match_operand:DI 1 "register_operand" ""))
(clobber (match_scratch:DI 2 ""))
(clobber (match_scratch:DI 3 ""))]
"reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
[(const_int 0)]
{
ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
operands[3], true, false);
DONE;
})
Therefore, the DCE pass doesn't see that the call is actually pure. At -O2 we
run a DCE pass just before combine. I'm going to adjust the testcase.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42461