[cfe-dev] Enhancing the DataFlowSolver in clang
spellegrini at dps.uibk.ac.at
Wed Jul 21 01:28:08 PDT 2010
On 07/20/2010 08:56 PM, Ted Kremenek wrote:
> On Jul 20, 2010, at 7:52 AM, Simone Pellegrini wrote:
>> I run make tests from the root clang folder and none of the existing tests have been broken.
>> In attachment the patch file with the fix to the DataFlowSolver.h
> I think this patch is mostly there, but the following assumes that ValTy is a bitvector:
> + // if there the block value has been initialized, and this is the first
> + // iteration, use the initialized value
> + if(noEdges and !D.getBlockDataMap()[B].sizesEqual(ValTy()))
> + Merge(V, D.getBlockDataMap()[B]);
> 'sizesEqual' should not appear anywhere in DataSolver.h. The solver needs to be generic to not assume specific details of ValTy.
I removed the sizesEqual check. Now, I just search for the block B in
the map, if there is no entry in the BlockDataMap it means the user
didn't provide any initialization. In this way we didn't assume any
specific detail of ValTy.
> A performance nit: here 'getBlockDataMap()' is called twice. That's wasteful as it requires two lookups in the hashtable instead of one.
I also optimized the code by reducing the number of lookups to 1.
> Also, please use spaces instead of tabs.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1511 bytes
Desc: not available
More information about the cfe-dev