]> granicus.if.org Git - llvm/commit
[Devirtualization] MemDep returns non-local !invariant.group dependencies
authorPiotr Padlewski <piotr.padlewski@gmail.com>
Thu, 12 Jan 2017 11:33:58 +0000 (11:33 +0000)
committerPiotr Padlewski <piotr.padlewski@gmail.com>
Thu, 12 Jan 2017 11:33:58 +0000 (11:33 +0000)
commit4e1eef18555afaa48cf1c1aecaeffe2aba3edbd5
treedb375d8f70001db938d66d2de04b93feca33edc6
parentdfe0691ff48fb966f2accf21959a16d5a728e08d
[Devirtualization] MemDep returns non-local !invariant.group dependencies

Summary:
Memory Dependence Analysis was limited to return only local dependencies
for invariant.group handling. Now it returns NonLocal when it finds it
and then by asking getNonLocalPointerDependency we get found dep.

Thanks to this we are able to devirtualize loops!

    void indirect(A &a, int n) {
      for (int i = 0 ; i < n; i++)
        a.foo();

    }
    void test(int n) {
      A a;
      indirect(a);
    }

After inlining a.foo() will be changed to direct call, even if foo and A::A()
is external (but only if vtable definition is be available).

Reviewers: nlewycky, dberlin, chandlerc, rsmith

Subscribers: mehdi_amini, davide, llvm-commits

Differential Revision: https://reviews.llvm.org/D28137

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291762 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/MemoryDependenceAnalysis.h
lib/Analysis/MemoryDependenceAnalysis.cpp
test/Transforms/GVN/assume-equal.ll
test/Transforms/GVN/invariant.group.ll
test/Transforms/NewGVN/assume-equal.ll
test/Transforms/NewGVN/invariant.group.ll