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]

Re: patch to implement thread coloring in IRA


> Vladimir Makarov wrote:
> 
> >      PR rtl-optimization/59036
> >          * ira-color.c (struct allocno_color_data): Add new members
> >          first_thread_allocno, next_thread_allocno, thread_freq.
> >          (sorted_copies): New static var.
> >          (allocnos_conflict_by_live_ranges_p, copy_freq_compare_func): Move
> >          up.
> >          (allocno_thread_conflict_p, merge_threads)
> >          (form_threads_from_copies, form_threads_from_bucket)
> >          (form_threads_from_colorable_allocno, init_allocno_threads): New
> >          functions.
> >          (bucket_allocno_compare_func): Add comparison by thread frequency
> >          and threads.
> >          (add_allocno_to_ordered_bucket): Rename to
> >          add_allocno_to_ordered_colorable_bucket.  Remove parameter.
> >          (push_only_colorable): Call form_threads_from_bucket.
> >          (color_pass): Call init_allocno_threads.  Use
> >          consideration_allocno_bitmap instead of coloring_allocno_bitmap
> >          for nuillify allocno color data.
> >          (ira_initiate_assign, ira_finish_assign): Allocate/free
> >          sorted_copies.
> >          (coalesce_allocnos): Use static sorted copies.
> 
> Unfortunately, this patch causes cc1 for powerpc64-linux to crash for me
> even when compiling "int main () { return 0; }" with -O due to a memory
> corruption somewhere:

valgrind says it's a double free:

n==15063== Invalid free() / delete / delete[] / realloc()                                                                                                           
==15063==    at 0x4026FB8: free (vg_replace_malloc.c:446)                                                                                                               
==15063==    by 0x1060F92F: ira_free(void*) (ira.c:666)                                                                                                                 
==15063==    by 0x10643233: ira_finish_assign() (ira-color.c:4682)                                                                                                      
==15063==    by 0x10618AEF: (anonymous namespace)::pass_reload::execute() (ira.c:5430)                                                                                  
==15063==    by 0x1071E8E7: execute_one_pass(opt_pass*) (passes.c:2217)                                                                                                 
==15063==    by 0x1071EC53: execute_pass_list(opt_pass*) (passes.c:2270)                                                                                                
==15063==    by 0x1071EC9B: execute_pass_list(opt_pass*) (passes.c:2271)                                                                                                
==15063==    by 0x10335B97: expand_function(cgraph_node*) (cgraphunit.c:1753)                                                                                           
==15063==    by 0x103361BF: expand_all_functions() (cgraphunit.c:1858)                                                                                                  
==15063==    by 0x1033713B: compile() (cgraphunit.c:2195)                                                                                                               
==15063==    by 0x10337393: finalize_compilation_unit() (cgraphunit.c:2272)                                                                                             
==15063==    by 0x1012F043: c_write_global_declarations() (c-decl.c:10374)                                                                                              
==15063==  Address 0x43faf90 is 0 bytes inside a block of size 1 free'd                                                                                                 
==15063==    at 0x4026FB8: free (vg_replace_malloc.c:446)                                                                                                               
==15063==    by 0x1060F92F: ira_free(void*) (ira.c:666)                                                                                                                 
==15063==    by 0x1063F227: coalesce_allocnos() (ira-color.c:3793)                                                                                                      
==15063==    by 0x1064044B: ira_sort_regnos_for_alter_reg(int*, int, unsigned int*) (ira-color.c:4095)                                                                  
==15063==    by 0x1077CBC7: reload(rtx_def*, int) (reload1.c:790)                                                                                                       
==15063==    by 0x106193D3: (anonymous namespace)::pass_reload::execute() (ira.c:5419)                                                                                  
==15063==    by 0x1071E8E7: execute_one_pass(opt_pass*) (passes.c:2217)                                                                                                 
==15063==    by 0x1071EC53: execute_pass_list(opt_pass*) (passes.c:2270)                                                                                                
==15063==    by 0x1071EC9B: execute_pass_list(opt_pass*) (passes.c:2271)                                                                                                
==15063==    by 0x10335B97: expand_function(cgraph_node*) (cgraphunit.c:1753)                                                                                           
==15063==    by 0x103361BF: expand_all_functions() (cgraphunit.c:1858)                                                                                                  
==15063==    by 0x1033713B: compile() (cgraphunit.c:2195)                                                                                                               
==15063==                                                                                                                                                               

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


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