What loop optimizations could increase the code size significantly?

2010-12-10 Thread Fang, Changpeng
Hi, I am kooking ways to reduce the code size. What loop optimizations could increase the code size significantly? The optimization I know are: unswitch, vectorization, prefetch and unrolling. We should not perform these optimizations if the loop just roll a few iterations. In addition, what l

RE: How to avoid auto-vectorization for this loop (rolls at most 3 times)

2010-09-09 Thread Fang, Changpeng
>> It seems the auto-vectorizer could not recognize that this loop will >> roll at most 3 times. >> And it will generate quite messy code. >> >> int a[1024], b[1024]; >> void foo (int n) >> { >> int i; >> for (i = (n/4)*4; i< n; i++) >> a[i] = a[i] + b[i]; >> } >> >> How can we correctly

How to avoid auto-vectorization for this loop (rolls at most 3 times)

2010-09-08 Thread Fang, Changpeng
It seems the auto-vectorizer could not recognize that this loop will roll at most 3 times. And it will generate quite messy code. int a[1024], b[1024]; void foo (int n) { int i; for (i = (n/4)*4; i< n; i++) a[i] = a[i] + b[i]; } How can we correctly estimate the number of iteratio

RE: Could we use VIEW_CONVERT_EXPR to build ADDR_EXPR ?

2010-08-20 Thread Fang, Changpeng
> >No you should not generate addresses for VCEs that contain a SSA_NAME. > > I think you should check if get_base_address is a > >is_gimple_addressable inside gather_memory_references_ref. > > There, TREE_CODE ( get_base_address (ref)) == SSA_NAME > > and get_base_address (ref) is is_gimple_addr

RE: Could we use VIEW_CONVERT_EXPR to build ADDR_EXPR ?

2010-08-20 Thread Fang, Changpeng
>No you should not generate addresses for VCEs that contain a SSA_NAME. > I think you should check if get_base_address is a >is_gimple_addressable inside gather_memory_references_ref. There, TREE_CODE ( get_base_address (ref)) == SSA_NAME and get_base_

Could we use VIEW_CONVERT_EXPR to build ADDR_EXPR ?

2010-08-19 Thread Fang, Changpeng
Hi, I am working on bug 45260 and found that the problem is related to VIEW_CONVERT_EXPR. In the prefetching pass, we generate the base address for the prefetching: tree-ssa-loop-prefetch.c (issue_prefetch_ref): addr_base = build_fold_addr_expr_with_type (ref->mem, ptr_type_node); + gcc_asser