[cfe-dev] trivial conditions and dataflow solver

Maarten Wiggers mwiggers at us.fujitsu.com
Thu Oct 20 13:36:01 PDT 2011


Hi Ted,

Yes, I am using the DataflowSolver class. Thanks for the heads-up on potential removal of this class. I was under the impression that this was the default Flow Analysis engine, but will look at the current implementation of the analyses to understand alternative options.

Thanks,
Maarten

From: Ted Kremenek [mailto:kremenek at apple.com]
Sent: Wednesday, October 19, 2011 10:05 PM
To: Maarten Wiggers
Cc: 'cfe-dev at cs.uiuc.edu'
Subject: Re: [cfe-dev] trivial conditions and dataflow solver

Hi Maarten,

Can you be a bit more specific on what you are doing?  Are you using the actual DataflowSolver class?  If so, currently ALL blocks are currently enqueued by the solver, not just the roots.  IRRC, this was to address an issue that previously existed with the solver and one of the analyses, but now no analyses use the solver anymore this behavior certainly can be changed.

FWIW, I was considering removing this class completely, since it is no longer used.

Ted

On Oct 19, 2011, at 6:40 PM, Maarten Wiggers wrote:


Hi,

I am experimenting with the dataflow solver and am wondering whether the following is expected behavior.

I took a function with a trivially true if condition. When constructing the CFG, clang seems to take this into account and does not generate a successor/predecessor relationship between blocks B1 and B3 (see below). However, when running the dataflow solver, I get that {field3, field2} and {field1} are possible sets of accesses to fields, while I would expect that either {field3,field1} or nothing is reported instead of {field1}. Currently, it seems block B1 is visited and its results are propagated, but it does not receive input values from B3.

Is this the intended behavior? I would expect that blocks without predecessors and that are not entry blocks would be skipped?

Thanks,
Maarten

Example function:

void func1()
{
field3 = 5
if(1)
field2 = 2;
else
field1 = 2;
}

A dump of the CFG gives:

[B4 (Entry) ]
Predecessors (0):
Successors (1): B3

[B1]
1: this->field1 = 2
Predecessors (0);
Successors (1): B0

[B2]
1: this->field2 = 2
Predecessors(1):B3
Successors(1):B0

[B3]
1: this->field3 = 5
2: 1
T: if [B3.2]
Predecessors (1): B4
Successors(2): B2 Null

[B0 (Exit) ]
Predecessors(2):B1 B2
Successors(0):
_______________________________________________
cfe-dev mailing list
cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111020/9ccd9305/attachment.html>


More information about the cfe-dev mailing list