[all-commits] [llvm/llvm-project] 7175cf: [Polly] Reuse multiple uses in operand tree.

Michael Kruse via All-commits all-commits at lists.llvm.org
Tue Oct 20 16:06:05 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7175cffb2133048018df74c1b49d1d4962ea18f2
      https://github.com/llvm/llvm-project/commit/7175cffb2133048018df74c1b49d1d4962ea18f2
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2020-10-20 (Tue, 20 Oct 2020)

  Changed paths:
    M polly/lib/Transform/ForwardOpTree.cpp
    M polly/test/ForwardOpTree/forward_load_tripleuse.ll
    A polly/test/ForwardOpTree/forward_reusue.ll

  Log Message:
  -----------
  [Polly] Reuse multiple uses in operand tree.

Recursively traversing the operand tree leads to an exponential blowup
if instructions are used multiple times due to every path leading to an
additional copy of the instructions after forwarding. This problem was
marked as a TODO in the code and was reported as a bug in llvm.org/PR47340.

Fix by caching already visited instructions and returning the cached
version when already visited. Instead of calling forwardTree() twice,
return a ForwardingAction structure that contains a lambda which will
carry-out the forwarding when requested. The lambdas are executed in
reverse-postorder to mimic the previous recursive calls unless there
is a reuse.

Fixes llvm.org/PR47340




More information about the All-commits mailing list