On Thu, Nov 24, 2016 at 4:22 PM, Bin Cheng <bin.ch...@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 ...

Thanks,
Richard.

> Thanks,
> bin
>
> 2016-11-24  Bin Cheng  <bin.ch...@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.ch...@arm.com>
>
>         PR middle-end/78507
>         PR middle-end/78510
>         * g++.dg/torture/pr78507.C: New test.
>         * gcc.dg/torture/pr78510.c: New test.

Reply via email to