implied: re-order where we calculate implications
commite3bde024cd1bff0b3b336898c2f59c9749e7ca71
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 10 Aug 2015 13:24:16 +0000 (10 16:24 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Mon, 10 Aug 2015 13:24:16 +0000 (10 16:24 +0300)
tree3e7dbb7e9469b8ce4487f6d2bdf2b33ec340f6ff
parent3d395324543679042f196adcd2f65de524c726e7
implied: re-order where we calculate implications

This change is part of a larger change I am going to commit next.  That
change sets it so that we can calculate implications based on previously
stored conditions.  The code looks like this:

if (foo & FLAG)
lock();
...
if (foo & FLAG)
unlock();

The problem that I found was that stored conditions stores links.  We want
to create the links every time there is a condition.  But instead we were
creating the links and then overwriting them with the old implied links.

What we should do, I think now, is use the implications, then evaluate the
condition and create the new links.  I have tested this and it works.  My
only question is that I obviously went to a lot of effort to preserve the
implied states and write them last.  Why did I do that?  I cannot remember.
It was in 371953642524 ('implied: use comparison information for
implications'), the changelog is not clear.  Also before that patch the
smatch_extra stuff calculated implications and then over wrote them
base on the condition itself.

For now, I'm going to commit this small change and redo it later if I find
an issue.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_implied.c