summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms/MaterializeVectors.cpp
diff options
context:
space:
mode:
authorUday Bondhugula <bondhugula@google.com>2018-12-30 20:38:04 -0800
committerjpienaar <jpienaar@google.com>2019-03-29 14:48:44 -0700
commitf12182157ec65a813b5e5f08495c6d1c0559a82e (patch)
tree91a53553f2d52ab03c77db31c492f23497011c26 /mlir/lib/Transforms/MaterializeVectors.cpp
parentcea9f28a2c6cbc914f0c9cb145df98e128a9daf1 (diff)
downloadbcm5719-llvm-f12182157ec65a813b5e5f08495c6d1c0559a82e.tar.gz
bcm5719-llvm-f12182157ec65a813b5e5f08495c6d1c0559a82e.zip
Introduce PostDominanceInfo, fix properlyDominates() for Instructions
- introduce PostDominanceInfo in the right/complete way and use that for post dominance check in store-load forwarding - replace all uses of Analysis/Utils::dominates/properlyDominates with DominanceInfo::dominates/properlyDominates - drop all redundant copies of dominance methods in Analysis/Utils/ - in pipeline-data-transfer, replace dominates call with a much less expensive check; similarly, substitute dominates() in checkMemRefAccessDependence with a simpler check suitable for that context - fix a bug in properlyDominates - improve doc for 'for' instruction 'body' PiperOrigin-RevId: 227320507
Diffstat (limited to 'mlir/lib/Transforms/MaterializeVectors.cpp')
-rw-r--r--mlir/lib/Transforms/MaterializeVectors.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp
index 37f0f571a0f..1ab1f6361d3 100644
--- a/mlir/lib/Transforms/MaterializeVectors.cpp
+++ b/mlir/lib/Transforms/MaterializeVectors.cpp
@@ -21,6 +21,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Analysis/AffineAnalysis.h"
+#include "mlir/Analysis/Dominance.h"
#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Analysis/MLFunctionMatcher.h"
#include "mlir/Analysis/SliceAnalysis.h"
@@ -650,10 +651,12 @@ static bool emitSlice(MaterializationState *state,
/// Additionally, this set is limited to instructions in the same lexical scope
/// because we currently disallow vectorization of defs that come from another
/// scope.
+/// TODO(ntv): please document return value.
static bool materialize(Function *f,
const SetVector<OperationInst *> &terminators,
MaterializationState *state) {
DenseSet<Instruction *> seen;
+ DominanceInfo domInfo(f);
for (auto *term : terminators) {
// Short-circuit test, a given terminator may have been reached by some
// other previous transitive use-def chains.
@@ -669,13 +672,13 @@ static bool materialize(Function *f,
// Note for the justification of this restriction.
// TODO(ntv): relax scoping constraints.
auto *enclosingScope = term->getParentInst();
- auto keepIfInSameScope = [enclosingScope](Instruction *inst) {
+ auto keepIfInSameScope = [enclosingScope, &domInfo](Instruction *inst) {
assert(inst && "NULL inst");
if (!enclosingScope) {
// by construction, everyone is always under the top scope (null scope).
return true;
}
- return properlyDominates(*enclosingScope, *inst);
+ return domInfo.properlyDominates(enclosingScope, inst);
};
SetVector<Instruction *> slice =
getSlice(term, keepIfInSameScope, keepIfInSameScope);
OpenPOWER on IntegriCloud