<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 03/28/2016 10:50 AM, Hal Finkel wrote:
<blockquote
cite="mid:6836018.103.1459180251927.JavaMail.javamailuser@localhost"
type="cite">
<div style="font-family: arial,helvetica,sans-serif; font-size:
10pt; color: #000000"><br>
<blockquote id="DWT1341" style="border-left: 2px solid rgb(16,
16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0,
0, 0); font-weight: normal; font-style: normal;
text-decoration: none; font-family:
Helvetica,Arial,sans-serif; font-size: 12pt;">
<div class="moz-cite-prefix">On 03/28/2016 12:37 AM, Chris
Lattner wrote:<br>
</div>
<blockquote
cite="mid:B017C534-9BF7-4C40-B2DF-A6BA3790C356@apple.com">
<div>It changes all the time. Here’s a trivial example,
assume no inlining and no AA other than the one in
question:</div>
<div class=""><br class="">
</div>
<blockquote style="margin: 0pt 0pt 0pt 40px; border: medium
none; padding: 0px;" class="">
<div class="">std::vector<int> V1 = { 1, 2, 3 };</div>
<div class="">
<div class="">std::vector<int> V2 = { 4, 5, 6 };</div>
</div>
<div class=""><br class="">
</div>
<div class="">V1.pop_back(); // Mutates *this</div>
<div class=""><br class="">
</div>
<div class="">auto length = V1.size();</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">V2.pop_back(); // Mutates *this</div>
</div>
<div class=""><br class="">
</div>
<div class="">auto zero = length - V1.size()</div>
</blockquote>
<br>
</blockquote>
</blockquote>
Can you elaborate on what you mean by flow sensitive? We have a
mod/ref query interface that can return answers specific to a
particular instruction/call pair. The code above could easily
live in a single basic block, and if we had function attribute
deduction on the 'argmemonly' attribute, we could probably do
this now.<br>
<br>
-Hal<span name="x"></span><br>
</div>
</blockquote>
<br>
What I meant is that the CSE needs to be aware of the execution
order, i.e. the call to V1.pop_back() should not be in the middle of
the two V1.size() for zero to be 0. If there exists more complicated
control flows, CSE needs to be able to make the same kind of
argument across basic blocks.<br>
<br>
I didn't follow LLVM development very closely to be familiar with
how LLVM handles CSE. If what I said above is exactly how it works
today, then yes we could probably do this now.<br>
<br>
But still, there is no APIs that answers "are p and q aliases before
this instruction x?". The same can be done for mod-ref today (if I
remembered correctly this isn't even the case before the AAResult
class came into existence), but not for aliases. <br>
<br>
-- <br>
Best Regards,<br>
<br>
--<br>
Jia Chen<br>
</body>
</html>