summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2017-07-24 15:33:53 +0000
committerMichael Kruse <llvm@meinersbur.de>2017-07-24 15:33:53 +0000
commitd85e345ce091eca4f918706152c3af5cd65cb185 (patch)
tree379006a7b0716986673db083f95494e06ee22d49
parent2d94405a32b05e0343090e7f16f9fd1112c66b9d (diff)
downloadbcm5719-llvm-d85e345ce091eca4f918706152c3af5cd65cb185.tar.gz
bcm5719-llvm-d85e345ce091eca4f918706152c3af5cd65cb185.zip
[ForwardOpTree] Add comments to ForwardingDecision items. NFC.
In particular, explain the difference between FD_CanForward and FD_CanForwardTree. llvm-svn: 308885
-rw-r--r--polly/lib/Transform/ForwardOpTree.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/polly/lib/Transform/ForwardOpTree.cpp b/polly/lib/Transform/ForwardOpTree.cpp
index fe5a6311af8..48a652fb35c 100644
--- a/polly/lib/Transform/ForwardOpTree.cpp
+++ b/polly/lib/Transform/ForwardOpTree.cpp
@@ -36,10 +36,33 @@ STATISTIC(ScopsModified, "Number of SCoPs with at least one forwarded tree");
namespace {
/// The state of whether an operand tree was/can be forwarded.
+///
+/// The items apply to an instructions and its operand tree with the instruction
+/// as the root element. If the value in question is not an instruction in the
+/// SCoP, it can be a leaf of an instruction's operand tree.
enum ForwardingDecision {
+ /// The root instruction or value cannot be forwarded at all.
FD_CannotForward,
+
+ /// The root instruction or value can be forwarded as a leaf of a larger
+ /// operand tree.
+ /// It does not make sense to move the value itself, it would just replace it
+ /// by a use of itself. For instance, a constant "5" used in a statement can
+ /// be forwarded, but it would just replace it by the same constant "5".
+ /// However, it makes sense to move as an operand of
+ ///
+ /// %add = add 5, 5
+ ///
+ /// where "5" is moved as part of a larger operand tree. "5" would be placed
+ /// (disregarding for a moment that literal constants don't have a location
+ /// and can be used anywhere) into the same statement as %add would.
FD_CanForward,
+
+ /// The root instruction can be forwarded in a non-trivial way. This requires
+ /// the operand tree root to be an instruction in some statement.
FD_CanForwardTree,
+
+ /// Used to indicate that a forwarding has be carried out successfully.
FD_DidForward,
};
@@ -140,6 +163,13 @@ private:
return FD_CannotForward;
case VirtualUse::ReadOnly:
+ // Note that we cannot return FD_CanForwardTree here. With a operand tree
+ // depth of 0, UseVal is the use in TargetStmt that we try to replace.
+ // With -polly-analyze-read-only-scalars=true we would ensure the
+ // existence of a MemoryAccess (which already exists for a leaf) and be
+ // removed again by tryForwardTree because it's goal is to remove this
+ // scalar MemoryAccess. It interprets FD_CanForwardTree as the permission
+ // to do so.
if (!DoIt)
return FD_CanForward;
OpenPOWER on IntegriCloud