[LLVMdev] Leaks in PBQPBuilderWithCoalescing::build ?

Lang Hames
Wed, 10 Sep 2014 23:03:44 -0000

Hi Arnaud,

You're right: newCosts should be a copy of the node's costs, as it may
be
modified. When we call setNodeCost's, the PBQP::Vector's assignment
operator should free the old costs, but I may have misimplemented that (or
forgotten it entirely).

Cheers,
Lang.


On Wed, Sep 10, 2014 at 3:19 PM, Arnaud A. de Grandmaison <
arnaud.degrandmaison at arm.com> wrote:

> Hi Lang,
>
>
>
> In PBQPBuilderWithCoalescing::build, around line 360, we have code looking
> like:
>
>
>
> …
>
> PBQP::Vector newCosts(g.getNodeCosts(node));
>
> addPhysRegCoalesce(newCosts, pregOpt, cBenefit);
>
> g.setNodeCosts(node, newCosts);
>
> …
>
>
>
> I suspect the leak occurs around the setNodeCosts method, and I have
> trouble understanding how it handles the case where the node already has
> costs.
>
>
>
> It seems to me that:
>
> - we make of copy of the node’s costs (probably because someone else can
> refer to it ?)
>
> - we modify the copy
>
> - we set the node’s new costs. But what is supposed to happen there,
> especially in the CostAllocator part ?
>
>
>
> Could you shed some light there ?
>
>
>
> Thanks,
>
> Arnaud
>
>
>
>
>
>
>
> *From:* Lang Hames [mailto:lhames at gmail.com]
> *Sent:* 10 September 2014 19:26
> *To:* Arnaud De Grandmaison
> *Subject:* Re: Leaks in PBQPBuilderWithCoalescing::build ?
>
>
>
> Thanks Arnaud!
>
>
>
> - Lang.
>
>
>
> On Wed, Sep 10, 2014 at 11:23 AM, Arnaud A. de Grandmaison <
> arnaud.degrandmaison at arm.com> wrote:
>
> Hi Lang,
>
>
>
> For your information, the leak sanitizer found something when I committed
> my patch:
>
>
>
>
>
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/4506/steps/check-llvm%20asan/logs/stdio
>
>
>
> I will try to have a look at it.
>
>
>
> Cheers,
>
> --
>
> Arnaud A. de Grandmaison
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20140910/e7bccebf/attachment.html>