On June 21, 2020 11:38:49 AM GMT+02:00, Shuai Wang via Gcc <gcc@gcc.gnu.org> 
wrote:
>OK, I think I know how to solve it. Just return TODO_update_ssa
><https://code.woboq.org/gcc/gcc/tree-pass.h.html#249>.

If you dump with -vops you'll likely see that virtual operands got out of sync. 
You can either manually copy them from the original function calls or as you 
do, make sure update_ssa runs. 

Richard. 

>On Sun, Jun 21, 2020 at 5:34 PM Shuai Wang <wangshuai...@gmail.com>
>wrote:
>
>> Hello,
>>
>> I am doing instrumentation of GIMPLE code by adding extra coverage
>> counters at each basic block. Basically it's
>> mimicking -fsanitize-coverage=trace-pc, where the only difference is
>> that __sanitizer_cov_trace_pc (the default
>> hander of fsanitize-coverage=trace-pc)  has no input parameters, but
>my
>> coverage hander has a parameter of basic block id.
>>
>> My current issue is that after the instrumentation of one function,
>the
>> plugin throws an exception at the following gcc_assert and do not
>proceed
>> to instrument another function:
>>
>>   if (flags & TODO_cleanup_cfg)
>>     cleanup_tree_cfg (flags & TODO_update_ssa_any);
>>   else if (flags & TODO_update_ssa_any)
>>     update_ssa (flags & TODO_update_ssa_any);
>>   gcc_assert (!need_ssa_update_p (fn));  <----------  line 1954 of
>gcc/passes.c for gcc 10.1.0
>>
>> This really confused me, because when I print out the instrumented
>GIMPLE code and compare with fsanitize-coverage=trace-pc, I don't see a
>major difference here:
>>
>> ====== my instrumented GIMPLE code ===========
>>
>> fun2 ()
>> {
>>   int D.2588;
>>   int _3;
>>
>>   <bb 2> :
>>   __sanitizer_cov_trace_pc (2);  <--- my coverage hander with basic
>block id as the input
>>   __builtin_puts (&"fun2"[0]);
>>   _3 = 0;
>>
>>   <bb 3> :
>> <L0>:
>>   __sanitizer_cov_trace_pc (3);
>>   return _3;
>>
>> }
>>
>> ======= the corresponding instrumented GIMPLE code by
>fsanitize-coverage=trace-pc =====
>>
>> fun2 ()
>> {
>>   int D.2760;
>>   int _3;
>>
>>   <bb 2> [0.00%]:
>>   __builtin___sanitizer_cov_trace_pc ();
>>   __builtin_puts (&"fun2"[0]);
>>   _3 = 0;
>>
>> <L0> [0.00%]:
>>   __builtin___sanitizer_cov_trace_pc ();
>>   return _3;
>>
>> }
>>
>> There is no big difference here. Could anyone shed some lights on why
>an exception on "need_ssa_update_p" is thrown? I don't think there is
>an need to udpate any "SSA" here.. Thank you very much.
>>
>> Best,
>>
>> Shuai
>>
>>

Reply via email to