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]

[PATCH GCC][3/6]Fix PR80815 by handling negative DR_STEPs in runtime alias check


Hi,
This patch fixes PR80815 in which negative DR_STEP is mis-handled.  It does below:
  1) Reorder three cases in which we merge alias checks, in order like:
       old_case_A   ->  new_case_B
       old_case_B   ->  new_case_C (and removed as described in 3))
       old_case_C   ->  new_case_A
     This is because new_case_1 is accurate check that doesn't introduce false alias,
     while the other two does.
  2) Explicitly comment that Case A and B combined together can merge all dr_a1&dr_b and
     dr_a2&dr_b pairs if SEGMENT_LEN_A is constant.  We still keep Case A/B separately
     for clarity, also because Case A doesn't introduces false alias, while B does.
  3) Remove the old_case_C:
       	  /* Generally the new segment length is the maximum of the
	     left segment size and the right segment size plus the distance.
	     ???  We can also build tree MAX_EXPR here but it's not clear this
	     is profitable.  */
	  else if (tree_fits_uhwi_p (dr_a1->seg_len)
		   && tree_fits_uhwi_p (dr_a2->seg_len))
     This check is actually covered by A and B.
  4) Handle negative DR_STEPs explicitly.
  5) Add two tests illustrating wrong alias checking issue.

Bootstrap and test on x86_64 and AArch64, is it OK?

BTW, I tried to keep the change as minimal as possible, but ended up with quite
amount refactoring because the old cases are somehow duplicated/complicated,
and not fit to negative DR_STEPs handling.

Thanks,
bin
2017-05-22  Bin Cheng  <bin.cheng@arm.com>

	PR tree-optimization/80815
	* tree-data-ref.c (prune_runtime_alias_test_list): Simplify condition
	for merging runtime alias checks.  Handle negative DR_STEPs.

gcc/testsuite/ChangeLog
2017-05-22  Bin Cheng  <bin.cheng@arm.com>

	PR tree-optimization/80815
	* gcc.dg/vect/pr80815-1.c: New test.
	* gcc.dg/vect/pr80815-2.c: New test.

Attachment: 0003-negative-step-alias-check-20170516.txt
Description: 0003-negative-step-alias-check-20170516.txt


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