DSE calls to builtins (memset, etc)

Marc Glisse marc.glisse@inria.fr
Wed Aug 20 14:18:00 GMT 2014


On Wed, 20 Aug 2014, Richard Biener wrote:

>>>> -      if (stmt != use_stmt
>>>> -         && ref_maybe_used_by_stmt_p (use_stmt, gimple_assign_lhs
>>>> (stmt)))
>>>> -       return;
>>>> -
>>>
>>>
>>> I don't see how you can remove this code?
>>
>>
>> dse_possible_dead_store_p already tests ref_maybe_used_by_stmt_p and
>> thus cannot return true with such a use_stmt, as far as I can see. As I
>> said, bootstrap+testsuite with an assert instead of 'return' didn't turn
>> up anything. I could keep it as a gcc_checking_assert (with a slight
>> update to the comment) if you like. Or did I miss a path in
>> dse_possible_dead_store_p?
>
> Yes, the one that early returns from the operand_equal_p check.
>
> You might want to do some svn blaming to see what testcases
> were added with the above code (and the code surrounding it).
>
> I'm not sure either... so if it passes bootstrap & regtest it must be
> dead code... (well...)

The early return operand_equal_p has use_stmt == stmt, so it doesn't even 
reach the call to ref_maybe_used_by_stmt_p I am removing.

svn blame leads me to r132899 (gcc.c-torture/execute/pr35472.c)
and before that to r131101 (gcc.c-torture/execute/20071219-1.c)

Both testcases are still in the testsuite and passed. The rest of the code 
has changed quite a bit since then, it isn't that surprising if some test 
becomes redundant. But if it makes you nervous, we could keep it as a 
checking_assert, the cost should be negligible...

-- 
Marc Glisse



More information about the Gcc-patches mailing list