* [PATCH] forwprop: Remove incorrect assertion [PR102897]
@ 2021-10-26 3:40 Kewen.Lin
2021-10-26 7:50 ` Richard Biener
2021-10-27 7:51 ` [committed] testsuite: Fix up gcc.dg/pr102897.c testcase [PR102897] Jakub Jelinek
0 siblings, 2 replies; 5+ messages in thread
From: Kewen.Lin @ 2021-10-26 3:40 UTC (permalink / raw)
To: GCC Patches
Hi,
As PR102897 shows, there is one incorrect assertion in function
simplify_permutation, which is based on the wrong assumption that
all cases with op2_type == tgt_type are handled previously, the
proposed fix is to remove this wrong assertion.
Bootstrapped and regtested on x86_64-redhat-linux,
aarch64-linux-gnu and powerpc64{,le}-linux-gnu.
BR,
Kewen
-----
gcc/ChangeLog:
PR tree-optimization/102897
* tree-ssa-forwprop.c (simplify_permutation): Remove a wrong assertion.
gcc/testsuite/ChangeLog:
* gcc.dg/pr102897.c: New test.
---
gcc/testsuite/gcc.dg/pr102897.c | 16 ++++++++++++++++
gcc/tree-ssa-forwprop.c | 2 --
2 files changed, 16 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/pr102897.c
diff --git a/gcc/testsuite/gcc.dg/pr102897.c b/gcc/testsuite/gcc.dg/pr102897.c
new file mode 100644
index 00000000000..d96b0e48ccc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102897.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* Specify C99 to avoid the warning/error on compound literals. */
+/* { dg-options "-std=c99" } */
+
+/* Verify that there is no ICE. */
+
+typedef __attribute__((vector_size(8))) signed char int8x8_t;
+typedef __attribute__((vector_size(8))) unsigned char uint8x8_t;
+
+int8x8_t fn1 (int8x8_t val20, char tmp)
+{
+ uint8x8_t __trans_tmp_3;
+ __trans_tmp_3 = (uint8x8_t){tmp};
+ int8x8_t __a = (int8x8_t) __trans_tmp_3;
+ return __builtin_shuffle (__a, val20, (uint8x8_t){0});
+}
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 5b30d4c1a76..a830bab78ba 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -2267,8 +2267,6 @@ simplify_permutation (gimple_stmt_iterator *gsi)
if (!VECTOR_TYPE_P (tgt_type))
return 0;
tree op2_type = TREE_TYPE (op2);
- /* Should have folded this before. */
- gcc_assert (op2_type != tgt_type);
/* Figure out the shrunk factor. */
poly_uint64 tgt_units = TYPE_VECTOR_SUBPARTS (tgt_type);
--
2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] forwprop: Remove incorrect assertion [PR102897]
2021-10-26 3:40 [PATCH] forwprop: Remove incorrect assertion [PR102897] Kewen.Lin
@ 2021-10-26 7:50 ` Richard Biener
2021-10-26 10:08 ` Kewen.Lin
2021-10-27 7:51 ` [committed] testsuite: Fix up gcc.dg/pr102897.c testcase [PR102897] Jakub Jelinek
1 sibling, 1 reply; 5+ messages in thread
From: Richard Biener @ 2021-10-26 7:50 UTC (permalink / raw)
To: Kewen.Lin; +Cc: GCC Patches
On Tue, Oct 26, 2021 at 5:40 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>
> Hi,
>
> As PR102897 shows, there is one incorrect assertion in function
> simplify_permutation, which is based on the wrong assumption that
> all cases with op2_type == tgt_type are handled previously, the
> proposed fix is to remove this wrong assertion.
>
> Bootstrapped and regtested on x86_64-redhat-linux,
> aarch64-linux-gnu and powerpc64{,le}-linux-gnu.
I think you need to enable optimization in the new testcase, gcc.dg/ only
runs -O0 by default which wouldn't trigger forwprop? Please verify the
testcase ICEs before the fix.
Otherwise OK.
Thanks,
Richard,
> BR,
> Kewen
> -----
> gcc/ChangeLog:
>
> PR tree-optimization/102897
> * tree-ssa-forwprop.c (simplify_permutation): Remove a wrong assertion.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/pr102897.c: New test.
> ---
> gcc/testsuite/gcc.dg/pr102897.c | 16 ++++++++++++++++
> gcc/tree-ssa-forwprop.c | 2 --
> 2 files changed, 16 insertions(+), 2 deletions(-)
> create mode 100644 gcc/testsuite/gcc.dg/pr102897.c
>
> diff --git a/gcc/testsuite/gcc.dg/pr102897.c b/gcc/testsuite/gcc.dg/pr102897.c
> new file mode 100644
> index 00000000000..d96b0e48ccc
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr102897.c
> @@ -0,0 +1,16 @@
> +/* { dg-do compile } */
> +/* Specify C99 to avoid the warning/error on compound literals. */
> +/* { dg-options "-std=c99" } */
> +
> +/* Verify that there is no ICE. */
> +
> +typedef __attribute__((vector_size(8))) signed char int8x8_t;
> +typedef __attribute__((vector_size(8))) unsigned char uint8x8_t;
> +
> +int8x8_t fn1 (int8x8_t val20, char tmp)
> +{
> + uint8x8_t __trans_tmp_3;
> + __trans_tmp_3 = (uint8x8_t){tmp};
> + int8x8_t __a = (int8x8_t) __trans_tmp_3;
> + return __builtin_shuffle (__a, val20, (uint8x8_t){0});
> +}
> diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
> index 5b30d4c1a76..a830bab78ba 100644
> --- a/gcc/tree-ssa-forwprop.c
> +++ b/gcc/tree-ssa-forwprop.c
> @@ -2267,8 +2267,6 @@ simplify_permutation (gimple_stmt_iterator *gsi)
> if (!VECTOR_TYPE_P (tgt_type))
> return 0;
> tree op2_type = TREE_TYPE (op2);
> - /* Should have folded this before. */
> - gcc_assert (op2_type != tgt_type);
>
> /* Figure out the shrunk factor. */
> poly_uint64 tgt_units = TYPE_VECTOR_SUBPARTS (tgt_type);
> --
> 2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] forwprop: Remove incorrect assertion [PR102897]
2021-10-26 7:50 ` Richard Biener
@ 2021-10-26 10:08 ` Kewen.Lin
0 siblings, 0 replies; 5+ messages in thread
From: Kewen.Lin @ 2021-10-26 10:08 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches
Hi Richi,
on 2021/10/26 下午3:50, Richard Biener wrote:
> On Tue, Oct 26, 2021 at 5:40 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>>
>> Hi,
>>
>> As PR102897 shows, there is one incorrect assertion in function
>> simplify_permutation, which is based on the wrong assumption that
>> all cases with op2_type == tgt_type are handled previously, the
>> proposed fix is to remove this wrong assertion.
>>
>> Bootstrapped and regtested on x86_64-redhat-linux,
>> aarch64-linux-gnu and powerpc64{,le}-linux-gnu.
>
> I think you need to enable optimization in the new testcase, gcc.dg/ only
> runs -O0 by default which wouldn't trigger forwprop? Please verify the
> testcase ICEs before the fix.
>
Thanks for catching! You are right, the optimization option is required,
I just verified it and committed with the additional "-O1" as r12-4705.
> Otherwise OK.
>
Thanks!
BR,
Kewen
> Thanks,
> Richard,
>
>> BR,
>> Kewen
>> -----
>> gcc/ChangeLog:
>>
>> PR tree-optimization/102897
>> * tree-ssa-forwprop.c (simplify_permutation): Remove a wrong assertion.
>>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.dg/pr102897.c: New test.
>> ---
>> gcc/testsuite/gcc.dg/pr102897.c | 16 ++++++++++++++++
>> gcc/tree-ssa-forwprop.c | 2 --
>> 2 files changed, 16 insertions(+), 2 deletions(-)
>> create mode 100644 gcc/testsuite/gcc.dg/pr102897.c
>>
>> diff --git a/gcc/testsuite/gcc.dg/pr102897.c b/gcc/testsuite/gcc.dg/pr102897.c
>> new file mode 100644
>> index 00000000000..d96b0e48ccc
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.dg/pr102897.c
>> @@ -0,0 +1,16 @@
>> +/* { dg-do compile } */
>> +/* Specify C99 to avoid the warning/error on compound literals. */
>> +/* { dg-options "-std=c99" } */
>> +
>> +/* Verify that there is no ICE. */
>> +
>> +typedef __attribute__((vector_size(8))) signed char int8x8_t;
>> +typedef __attribute__((vector_size(8))) unsigned char uint8x8_t;
>> +
>> +int8x8_t fn1 (int8x8_t val20, char tmp)
>> +{
>> + uint8x8_t __trans_tmp_3;
>> + __trans_tmp_3 = (uint8x8_t){tmp};
>> + int8x8_t __a = (int8x8_t) __trans_tmp_3;
>> + return __builtin_shuffle (__a, val20, (uint8x8_t){0});
>> +}
>> diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
>> index 5b30d4c1a76..a830bab78ba 100644
>> --- a/gcc/tree-ssa-forwprop.c
>> +++ b/gcc/tree-ssa-forwprop.c
>> @@ -2267,8 +2267,6 @@ simplify_permutation (gimple_stmt_iterator *gsi)
>> if (!VECTOR_TYPE_P (tgt_type))
>> return 0;
>> tree op2_type = TREE_TYPE (op2);
>> - /* Should have folded this before. */
>> - gcc_assert (op2_type != tgt_type);
>>
>> /* Figure out the shrunk factor. */
>> poly_uint64 tgt_units = TYPE_VECTOR_SUBPARTS (tgt_type);
>> --
>> 2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [committed] testsuite: Fix up gcc.dg/pr102897.c testcase [PR102897]
2021-10-26 3:40 [PATCH] forwprop: Remove incorrect assertion [PR102897] Kewen.Lin
2021-10-26 7:50 ` Richard Biener
@ 2021-10-27 7:51 ` Jakub Jelinek
2021-10-27 9:24 ` Kewen.Lin
1 sibling, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2021-10-27 7:51 UTC (permalink / raw)
To: Kewen.Lin; +Cc: GCC Patches
On Tue, Oct 26, 2021 at 11:40:01AM +0800, Kewen.Lin via Gcc-patches wrote:
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/pr102897.c: New test.
The testcase FAILs on i686-linux due to:
FAIL: gcc.dg/pr102897.c (test for excess errors)
Excess errors:
.../gcc/gcc/testsuite/gcc.dg/pr102897.c:11:1: warning: MMX vector return without MMX enabled changes the ABI [-Wpsabi]
.../gcc/gcc/testsuite/gcc.dg/pr102897.c:10:10: warning: MMX vector argument without MMX enabled changes the ABI [-Wpsabi]
Fixed by adding -Wno-psabi.
Tested on x86_64-linux and i686-linux, committed to trunk as obvious.
2021-10-27 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/pr102897.c: Add -Wno-psabi to dg-options.
--- gcc/testsuite/gcc.dg/pr102897.c.jj 2021-10-27 09:00:28.848276246 +0200
+++ gcc/testsuite/gcc.dg/pr102897.c 2021-10-27 09:40:45.628296807 +0200
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* Specify C99 to avoid the warning/error on compound literals. */
-/* { dg-options "-O1 -std=c99" } */
+/* { dg-options "-O1 -std=c99 -Wno-psabi" } */
/* Verify that there is no ICE. */
Jakub
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [committed] testsuite: Fix up gcc.dg/pr102897.c testcase [PR102897]
2021-10-27 7:51 ` [committed] testsuite: Fix up gcc.dg/pr102897.c testcase [PR102897] Jakub Jelinek
@ 2021-10-27 9:24 ` Kewen.Lin
0 siblings, 0 replies; 5+ messages in thread
From: Kewen.Lin @ 2021-10-27 9:24 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: GCC Patches
Hi Jakub,
on 2021/10/27 下午3:51, Jakub Jelinek wrote:
> On Tue, Oct 26, 2021 at 11:40:01AM +0800, Kewen.Lin via Gcc-patches wrote:
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.dg/pr102897.c: New test.
>
> The testcase FAILs on i686-linux due to:
> FAIL: gcc.dg/pr102897.c (test for excess errors)
> Excess errors:
> .../gcc/gcc/testsuite/gcc.dg/pr102897.c:11:1: warning: MMX vector return without MMX enabled changes the ABI [-Wpsabi]
> .../gcc/gcc/testsuite/gcc.dg/pr102897.c:10:10: warning: MMX vector argument without MMX enabled changes the ABI [-Wpsabi]
> Fixed by adding -Wno-psabi.
>
> Tested on x86_64-linux and i686-linux, committed to trunk as obvious.
>
Thanks for fixing this up!
BR,
Kewen
> 2021-10-27 Jakub Jelinek <jakub@redhat.com>
>
> * gcc.dg/pr102897.c: Add -Wno-psabi to dg-options.
>
> --- gcc/testsuite/gcc.dg/pr102897.c.jj 2021-10-27 09:00:28.848276246 +0200
> +++ gcc/testsuite/gcc.dg/pr102897.c 2021-10-27 09:40:45.628296807 +0200
> @@ -1,6 +1,6 @@
> /* { dg-do compile } */
> /* Specify C99 to avoid the warning/error on compound literals. */
> -/* { dg-options "-O1 -std=c99" } */
> +/* { dg-options "-O1 -std=c99 -Wno-psabi" } */
>
> /* Verify that there is no ICE. */
>
>
>
> Jakub
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-27 9:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 3:40 [PATCH] forwprop: Remove incorrect assertion [PR102897] Kewen.Lin
2021-10-26 7:50 ` Richard Biener
2021-10-26 10:08 ` Kewen.Lin
2021-10-27 7:51 ` [committed] testsuite: Fix up gcc.dg/pr102897.c testcase [PR102897] Jakub Jelinek
2021-10-27 9:24 ` Kewen.Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).