[PATCH] D28137: [Devirtualization] MemDep returns non-local !invariant.group dependencies

Piotr Padlewski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 07:46:00 PST 2016


Prazek created this revision.
Prazek added reviewers: nlewycky, dberlin, chandlerc, rsmith.
Prazek added subscribers: llvm-commits, davide, mehdi_amini.

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 it is
external (but only if vtable definition will be available).


https://reviews.llvm.org/D28137

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28137.82593.patch
Type: text/x-patch
Size: 11892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161228/3dc46bc2/attachment.bin>


More information about the llvm-commits mailing list