This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR rtl-optimization/pr60663
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Zhenqiang Chen <zhenqiang dot chen at linaro dot org>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 26 Mar 2014 08:45:35 +0100
- Subject: Re: [PATCH] Fix PR rtl-optimization/pr60663
- Authentication-results: sourceware.org; auth=none
- References: <CACgzC7BAgdoKmKdNTnqoB+WgihgrAhSc4=FdXVUCRB7Pw6T+6Q at mail dot gmail dot com> <20140326070044 dot GD1817 at tucnak dot redhat dot com> <CACgzC7DWAAHxam=OHTqi4QNq479ECGX8PZoC6Fhw6RBgpFNasA at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Mar 26, 2014 at 03:30:44PM +0800, Zhenqiang Chen wrote:
> Agree. CSE should never modify asm insns to drop some of the outputs.
So the right fix is top prevent this from happening, not papering over about
it.
>
> But in this case, CSE does not drop any of the outputs. It just takes
> the SRC of a set and replace the reference of the set. And the
> instruction validation tells CSE that it is legal instruction after
> replacement. (The original correct asm insn is optimized away after
> this replacement)
>
> I think it is common for most rtl-optimizations to do such kind of
> validation. So to avoid such kind of bug, check_asm_operands must tell
> the optimizer the asm is illegal.
As it is wrong if CSE does that even with asm ("" : "=r" (i), "=r" (j));,
your patch is not the right place to fix this. CSE just must check where
the ASM_OPERANDS is coming from and if it comes from a PARALLEL with
multiple outputs, either give up or duplicate all outputs (if it makes sense
at all). Or just don't enter into the hash tables ASM_OPERANDS with
multiple outputs.
Jakub