This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
*PING* Re: [PATCH] Fix handling of very long asm statements in inliner
- From: Andi Kleen <andi at firstfloor dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: hubicka at ucw dot cz
- Date: Sun, 08 Sep 2013 12:44:30 -0700
- Subject: *PING* Re: [PATCH] Fix handling of very long asm statements in inliner
- Authentication-results: sourceware.org; auth=none
- References: <20130221140555 dot GE2928 at two dot firstfloor dot org>
Andi Kleen <andi@firstfloor.org> writes:
Ping!
This problem is still open, and afaik no better solution has been
proposed. It is also a regression.
Is it ok to commit if I rerun the tests and they pass?
> An auto generated program with a 6.4mio line asm statement gave
> with 4.7 and 4.8:
>
> xxx.c:6400017:1: internal compiler error: in account_size_time, at
> ipa-inline-analysis.c:601
>
> The problem is that the inliner counts the number of lines in the asm
> statement and multiplies that with a weight. With the weight this
> overflows 32bit signed int, and triggers an assert for negative time.
>
> Fix this by limiting the number of lines to 1000 for asm cost
> estimation. The RTL backend also does similar multiplications for
> jump shortening. I haven't tried to address this, but presumably
> it's less likely to result in a failure.
>
> Passes test suite on x86_64-linux.
>
> Ok for 4.7 and 4.8?
>
> 2013-02-17 Andi Kleen <ak@linux.intel.com>
>
> * tree-inline.c (estimate_num_insns): Limit asm cost to 1000.
>
> diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
> index 2a1b692..7f8f2f2 100644
> --- a/gcc/tree-inline.c
> +++ b/gcc/tree-inline.c
> @@ -3595,7 +3595,14 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
> return 0;
>
> case GIMPLE_ASM:
> - return asm_str_count (gimple_asm_string (stmt));
> + {
> + int count = asm_str_count (gimple_asm_string (stmt));
> + /* 1000 means infinity. This avoids overflows later
> + with very long asm statements. */
> + if (count > 1000)
> + count = 1000;
> + return count;
> + }
>
> case GIMPLE_RESX:
> /* This is either going to be an external function call with one
--
ak@linux.intel.com -- Speaking for myself only