free is a killer

Jeff Law law@redhat.com
Tue Oct 29 19:39:00 GMT 2013


On 10/29/13 00:38, Marc Glisse wrote:
> On Mon, 28 Oct 2013, Jeff Law wrote:
>
>> On 10/28/13 16:05, Marc Glisse wrote:
>>>
>>> I checked and it does the wrong thing (I don't have the testcase handy
>>> anymore, but it shouldn't be hard to recreate one), I even wrote a patch
>>> (attached) but it is related to:
>>> http://gcc.gnu.org/ml/gcc-patches/2013-10/msg02238.html
>>> so it can't go in. A more limited fix (still missing many cases) would
>>> be possible. I didn't test VA_END, but it doesn't look as bad (it is the
>>> SSA_NAME case that is wrong for memcpy
>> Actually, it's fairly easy to see with memset.  Something like this:
>>
>> /* { dg-do compile } */
>> /* { dg-options "-O1 -fdump-tree-optimized" } */
>>
>> void f (long *p) {
>>  *p = 42;
>>  p[4] = 42;
>>  __builtin_memset (p, 0, 100);
>> }
>>
>> /* { dg-final { scan-tree-dump-not "= 42" "optimized" } } */
>> /* { dg-final { cleanup-tree-dump "optimized" } } */
>
> Indeed. Do you want to commit it xfailed or put it in bugzilla so we
> don't lose it? (it becomes harder if you replace p with p-1 in the
> memset arguments).
BTW, you can get a VAR_DECL (and presumably a PARM_DECL) from 
ao_ref_base.  Some of the ssa-dse tests show this.

Jeff



More information about the Gcc-patches mailing list