[cfe-dev] trivial conditions and dataflow solver

Ted Kremenek kremenek at apple.com
Wed Oct 19 22:05:06 PDT 2011


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
> 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/20111019/15bc5c90/attachment.html>


More information about the cfe-dev mailing list