> 
> I am seeing an ICEs in offline pass.
> 
> 
> during IPA pass: afdo_offline
> gmsh/src/mesh/meshGEdge.cpp:979:1: internal compiler error: in 
> set_call_location, at auto-profile.cc:433

I added location and call_location into function instance that are
originally set to UNKNOWN_LOCATION and later they are re-written by
actual location of function and call to it (for inline instances).
The ICE means that we have two gimple call statements that we think
calls the given location which is likely problem iwth a discriminator.

create_gcov often outputs discriminator 0 for calls with discriinator
non-0.  This is common situatio nin C++ where single statement implies a
lot of calls. It is bug at create_gcov side in parsing dwarf5
abbreviations fixed by

diff --git a/util/symbolize/addr2line_inlinestack.cc 
b/util/symbolize/addr2line_inlinestack.cc
index f68f6e1..8eeb8bd 100644
--- a/util/symbolize/addr2line_inlinestack.cc
+++ b/util/symbolize/addr2line_inlinestack.cc
@@ -493,6 +493,12 @@ void InlineStackHandler::ProcessAttributeSigned(
         subprogram_stack_.back()->set_callsite_line(data);
         break;
 
+      // In case discriminator is implicit const, it is processed as signed
+      // rather then unsigned value.
+      case DW_AT_GNU_discriminator:
+        CHECK(form == DW_FORM_implicit_const);
+        subprogram_stack_.back()->set_callsite_discr(data);
+        break;
       default:
         break;
     }      

I tried to implement a workaround to match lost discriminator in cases
this is uniquely deterined, but it is not so easy to do.
My plan is to figure out how to upstream it and then drop the lost
discriminator workaround from match.

Do you see warnings with -Wauto-profile? 
Honza
>   979 | }
>       | ^
> 0x262582b internal_error(char const*, ...)
>         ../../gcc/gcc/diagnostic-global-context.cc:517
> 0x864513 fancy_abort(char const*, int, char const*)
>         ../../gcc/gcc/diagnostic.cc:1810
> 0x22da0e7 autofdo::function_instance::set_call_location(unsigned long)
>         ../../gcc/gcc/auto-profile.cc:433
> 0x22da0e7 autofdo::function_instance::set_call_location(unsigned long)
>         ../../gcc/gcc/auto-profile.cc:431
> 0x22da0e7 autofdo::function_instance::match(cgraph_node*, 
> vec<autofdo::function_instance*, va_heap, vl_ptr>&, hash_map<int_hash<int, 
> -1, -2>, int, simple_hashmap_traits<default_hash_traits<int_hash<int, -1, -2> 
> >, int> >&)
>         ../../gcc/gcc/auto-profile.cc:1498
> 0x22d8c8b autofdo::function_instance::match(cgraph_node*, 
> vec<autofdo::function_instance*, va_heap, vl_ptr>&, hash_map<int_hash<int, 
> -1, -2>, int, simple_hashmap_traits<default_hash_traits<int_hash<int, -1, -2> 
> >, int> >&)
>         ../../gcc/gcc/auto-profile.cc:1258
> 0x22d8c8b autofdo::function_instance::match(cgraph_node*, 
> vec<autofdo::function_instance*, va_heap, vl_ptr>&, hash_map<int_hash<int, 
> -1, -2>, int, simple_hashmap_traits<default_hash_traits<int_hash<int, -1, -2> 
> >, int> >&)
>         ../../gcc/gcc/auto-profile.cc:1638
> 0x22ddf6f autofdo::function_instance::match(cgraph_node*, 
> vec<autofdo::function_instance*, va_heap, vl_ptr>&, hash_map<int_hash<int, 
> -1, -2>, int, simple_hashmap_traits<default_hash_traits<int_hash<int, -1, -2> 
> >, int> >&)
>         ../../gcc/gcc/hash-table.h:994
> 0x22ddf6f autofdo::autofdo_source_profile::offline_external_functions()
>         ../../gcc/gcc/auto-profile.cc:2032
> 0x22de0f3 execute
>         ../../gcc/gcc/auto-profile.cc:4066
> 
> Here stmt is D.293641 = OBJ_TYPE_REF(_7;(const struct GEdge)from->57B) 
> (from); and set_call_location has call_location_ != UNKNOWN_LOCATION 
> 
> Thanks,
> Kugan

Reply via email to