This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH PR78507/PR78510]Fix two ICEs in pattern (cond (cmp (convert1? @1) @3) (convert2? @1) @2).


On Fri, Nov 25, 2016 at 8:23 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Thu, Nov 24, 2016 at 4:22 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>> Hi,
>> This patch fixes two issues in newly introduced pattern: (cond (cmp (convert1? @1) @3) (convert2? @1) @2).
>> For PR78507, we need to check if from_type is INTEGRAL_TYPE_P explicitly, this patch adds check for that.
>> Note we don't check c1_type/c2_type for that because it's guarded by INTEGER_CST@.
>> For PR78510, the ICE is covered by revision 242831, but underlying issue is when the block of conditions
>> is not satisfied, the last case simplification is applied anyway since code is initialized to cmp at the
>> first place.  This patch fixes that by setting code to proper value only when transformation is valid, it
>> also incorporates Marc's suggestion by using cmp directly.  Two tests are added too.
>> Bootstrap and test on x86_64 and AArch64 ongoing, is it OK if no failures?
>
> Ok.
>
> Btw,
>
> -  (cond (cmp@0 (convert1? @1) ...
> ...
> -     enum tree_code code = TREE_CODE (@0)...
>
> shows another misconception (I didn't notice...) in that TREE_CODE of a captured
> expression results in the expression code.  On GENERIC that works but on GIMPLE
> @0 will be a SSA_NAME and thus 'code' was SSA_NAME ...
Yes, that was a mistake.
Patch updated by including new test from duplicate PR78517.  Is it OK?

Thanks,
bin

2016-11-24  Bin Cheng  <bin.cheng@arm.com>

    PR middle-end/78507
    PR middle-end/78510
    PR middle-end/78517
    * match.pd ((cond (cmp (convert1? @1) @3) (convert2? @1) @2)): Use
    cmp directly, rather than cmp_code.  Initialize code to ERROR_MARK
    and set it to result code if transformation is valid.  Use code EQ
    directly in last simplification case.

gcc/testsuite/ChangeLog
2016-11-24  Bin Cheng  <bin.cheng@arm.com>

    PR middle-end/78507
    PR middle-end/78510
    PR middle-end/78517
    * g++.dg/torture/pr78507.C: New test.
    * gcc.dg/torture/pr78510.c: New test.
    * gcc.dg/torture/pr78517.c: New test.

>
> Thanks,
> Richard.
>
>> Thanks,
>> bin
>>
>> 2016-11-24  Bin Cheng  <bin.cheng@arm.com>
>>
>>         PR middle-end/78507
>>         PR middle-end/78510
>>         * match.pd ((cond (cmp (convert1? @1) @3) (convert2? @1) @2)): Use
>>         cmp directly, rather than cmp_code.  Initialize code to ERROR_MARK
>>         and set it to result code if transformation is valid.  Use code EQ
>>         directly in last simplification case.
>>
>> gcc/testsuite/ChangeLog
>> 2016-11-24  Bin Cheng  <bin.cheng@arm.com>
>>
>>         PR middle-end/78507
>>         PR middle-end/78510
>>         * g++.dg/torture/pr78507.C: New test.
>>         * gcc.dg/torture/pr78510.c: New test.

Attachment: pr78507-20161125.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]