[llvm] r215343 - In LVI(Lazy Value Info), originally value on a BB can only be caculated once,

Daniel Berlin dberlin at dberlin.org
Fri Sep 19 11:54:40 PDT 2014


Hey Jiangning,
Note that this also changes it from being O(n) to O(n^2) in terms of number
of iterations, since things can go back up the lattice now.  It also should
never happen :)


In the comments, you say
+  // Once this BB is encountered, Val's value for this BB will not be
Undefined
+  // any longer. When we encounter this BB again, if Val's value is
Overdefined,
+  // we need to compute its value again.
+  //
+  // For example, considering this control flow,
+  //   BB1->BB2, BB1->BB3, BB2->BB3, BB2->BB4
+  //
+  // Suppose we have "icmp slt %v, 0" in BB1, and "icmp sgt %v, 0" in BB3.
At
+  // the very beginning, when analyzing edge BB2->BB3, we don't know %v's
value
+  // in BB2, and the data flow algorithm tries to compute BB2's
predecessors, so
+  // then we know %v has negative value on edge BB1->BB2. And then we
return to
+  // check BB2 again, and at this moment BB2 has Overdefined value for %v
in
+  // BB2. So we should have to follow data flow propagation algorithm to
get the
+  // value on edge BB1->BB2 propagated to BB2, and finally %v on BB2 has a
+  // constant range describing a negative value.

This does not explain why BB2's value of %v started out as overdefined.
Somewhere in here, either propagation order is wrong, or the CFG has some
weirdness (is the CFG above the complete description of the testcase? Are
there critical edges).

IMHO, You should never have a case where things to go the wrong direction
in the lattice.


On Thu Sep 11 2014 at 8:47:56 PM Jiangning Liu <liujiangning1 at gmail.com>
wrote:

> Hi Joerg,
>
> Thanks for your command line, and it works!
>
> I've sent out a patch email to fix this problem, and you may want to have
> a look.
>
> Sorry for any inconvenience caused!
>
> Thanks again,
> -Jiangning
>
> 2014-09-09 17:50 GMT+08:00 Joerg Sonnenberger <joerg at britannica.bec.de>:
>
>> On Tue, Sep 09, 2014 at 11:41:00AM +0800, Jiangning Liu wrote:
>> > Hi Joerg,
>> >
>> > Sorry to know about this... I just came back from mid-autumn holiday...
>> >
>> > Can you tell me how you measured the memory consumption for llvm?
>>
>> Build with /usr/bin/time -v clang -O2 -c.
>>
>> Joerg
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140919/55f825be/attachment.html>


More information about the llvm-commits mailing list