[llvm-dev] Existing studies on the benefits of pointer analysis
Jia Chen via llvm-dev
llvm-dev at lists.llvm.org
Mon Mar 28 09:32:46 PDT 2016
On 03/28/2016 10:50 AM, Hal Finkel wrote:
>
> On 03/28/2016 12:37 AM, Chris Lattner wrote:
>
> It changes all the time. Here’s a trivial example, assume no
> inlining and no AA other than the one in question:
>
> std::vector<int> V1 = { 1, 2, 3 };
> std::vector<int> V2 = { 4, 5, 6 };
>
> V1.pop_back(); // Mutates *this
>
> auto length = V1.size();
>
> V2.pop_back(); // Mutates *this
>
> auto zero = length - V1.size()
>
>
> 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.
>
> -Hal
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.
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.
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.
--
Best Regards,
--
Jia Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160328/5fcadd58/attachment.html>
More information about the llvm-dev
mailing list