<div dir="ltr">Hi,<div><br></div><div>Attached patch is to fix an issue in lazy value info computation, and finally it can improve jump threading for a common case.</div><div><br></div><div>Lazy value info computation algorithm tries to use lattice to propagate the given value through control flow. The problem of the algorithm is the basic block can only be visited once. Once the lattice state is changed from "undefined" to other states, the lattice state will be cached, and won't be able to be changed any longer.</div>
<div><br></div><div>For the following simple control flow graph like below,</div><div><br></div><div>BB1->BB2, BB1->BB3, BB2->BB3, BB2->BB4<br></div><div><br></div><div>When computing a given value on edge BB2->BB3, if B2 doesn't have that value info at all, the algorithm will try to ask for information from BB2's predecessors, and then return to BB2 again to merge the info from predecessors, so BB2 will be visited twice. Unfortunately, at first visit of BB2, the lattice state will be changed from "undefined" to "overdefined", and then it will not be able to be changed any longer.</div>
<div><br></div><div>This patch is to simply check "overdefined", and make sure the algorithm can still move on to propagate the values from predecessor edges to the block itself.</div><div><br></div><div>The performance experiment for spec shows pretty good result on aarch64 for this fix, and the <span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12.800000190734863px;line-height:13.600079536437988px;background-color:rgb(240,240,240)">253_perlbmk can even have >5% performance improvement.</span> </div>
<div><br></div><div>Thanks,<br></div><div>-Jiangning</div></div>