Hi, 

        This is a simple fix for PR96698.

        For the test case, there are two PHIs in the inner loop in pass_vect

                <bb 5> [local count: 719407024]:
                # b_26 = PHI <0(4), b_15(10)>
                # c_27 = PHI <0(4), b_26(10)>

        c_27 = PHI <0(4), b_26(10)> is detected to be a vectorizable nested 
cycle by vect_is_simple_reduction incorrectly, and # b_26 = PHI <0(4), 
b_15(10)> is marked as the reduc_def of it, resulting in the crash.

        This patch adjusts the order of judgements in vect_is_simple_reduction 
to avoid the incorrect detection.

        Added one testcase for this. Bootstrap and tested on both aarch64 and 
x86 Linux platform, no new regression witnessed.

        Ok for trunk?`

Thanks, 
Yang Yang


+2020-08-20  Yang Yang  <yangyang...@huawei.com>
+
+       PR tree-optimization/96698
+       * tree-vect-loop.c (vect_is_simple_reduction): Moves the analysis
+       of phi nodes above the analysis of nested cycle to avoid the
+       incorrect detection.
+

+2020-08-20  Yang Yang  <yangyang...@huawei.com>
+
+       PR tree-optimization/96698
+       * gcc.dg/pr96698.c: New test.
+

Attachment: pr96698-v1.patch
Description: pr96698-v1.patch

Reply via email to