This is the mail archive of the 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]Pick up more address lowering cases for ivopt and tree-affine.c

I previously committed two patches lowering complex address expression for
IVOPT at and
When I bootstrapping GCC I found there were some peculiar cases like
&MEM[ptr+CST] + xxxx, which should be handled too.  This patch consists
below two changes:

1) change in alloc_iv:
Original code lowers top level complex address expressions like
&MEM[ptr+off].  The patch relaxes check condition in order to lower
expressions like &MEM[ptr+off] + xxx, just as the BASE from below dump:
use 2
  in statement _595 = &MEM[(void *)&this_prg + 36B] + _594;

  at position 
  type struct gcov_bucket_type *
  base (struct gcov_bucket_type *) &MEM[(void *)&this_prg + 36B] +
(sizetype) ((unsigned int) (src_i_683 + -1) * 20)
  step 4294967276
  base object (void *) &this_prg
  related candidates  

2) change in tree_to_aff_combination:
The function get_inner_reference returns "&MEM[ptr+off]" as the core for
input like the memory ADDRESS in below dump:
use 2
  in statement _59 = MEM[(const struct gcov_ctr_summary *)summary_22(D) +

  at position MEM[(const struct gcov_ctr_summary *)summary_22(D) +
  type const gcov_type *
  base (const gcov_type *) &MEM[(const struct gcov_ctr_summary
*)summary_22(D) + 4B] + 36
  step 20
  base object (void *) summary_22(D)
  related candidates 

Which can be further reduced into something like "summary_22(D) + 40B".
This change is necessary for the first one, because I am using
tree_to_aff_combination rather than get_inner_reference_aff now.

Bootstrap and test on x86/x86_64/arm.  Is it OK?


2013-11-25  Bin Cheng  <>

	* tree-ssa-loop-ivopts.c (contain_complex_addr_expr): New.
	(alloc_iv): Lower more cases by calling	contain_complex_addr_expr
	and tree_to_aff_combination.
	* tree-affine.c (tree_to_aff_combination): Handle &MEM[ptr+CST]
	in core part of complex reference.

2013-11-25  Bin Cheng  <>

	* gcc.dg/tree-ssa/ivopts-lower_base.c: New test.

Attachment: ivopt-lower-more-addr_expr-20131121.txt
Description: Text document

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