[PATCH] D37424: [ForwardOp] Remove read accesses for all instructions that have been moved

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 3 09:35:18 PDT 2017


Meinersbur added a comment.

The entire `return FD_ForwardTree` might be useless for forwarding loads, we always want to forward a load if it is accessed through its scalar (which is always the case, `forwardOperandTrees` only ever tries to forward scalars). This might be the better patch:

  diff --git a/lib/Transform/ForwardOpTree.cpp b/lib/Transform/ForwardOpTree.cpp
  index 894f8097..8f44cf33 100644
  --- a/lib/Transform/ForwardOpTree.cpp
  +++ b/lib/Transform/ForwardOpTree.cpp
  @@ -420,7 +420,7 @@ public:
       //   do not add another MemoryAccess.
       MemoryAccess *Access = TargetStmt->getArrayAccessOrNULLFor(LI);
       if (Access && !DoIt)
  -      return FD_CanForwardLeaf;
  +      return FD_CanForwardTree;
  
       if (DoIt)
         TargetStmt->prependInstruction(LI);


https://reviews.llvm.org/D37424





More information about the llvm-commits mailing list