summaryrefslogtreecommitdiffstats
path: root/mlir/lib/EDSC/MLIREmitter.cpp
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-02-01 16:42:18 -0800
committerjpienaar <jpienaar@google.com>2019-03-29 16:06:49 -0700
commit5052bd8582fbcfc0a4774c34141c2dd04b333613 (patch)
tree845641f175aee8c535a4d7deb43e5c854f07add4 /mlir/lib/EDSC/MLIREmitter.cpp
parente0774c008fdcee1d4007ede4fde4cf7ad83cfda8 (diff)
downloadbcm5719-llvm-5052bd8582fbcfc0a4774c34141c2dd04b333613.tar.gz
bcm5719-llvm-5052bd8582fbcfc0a4774c34141c2dd04b333613.zip
Define the AffineForOp and replace ForInst with it. This patch is largely mechanical, i.e. changing usages of ForInst to OpPointer<AffineForOp>. An important difference is that upon construction an AffineForOp no longer automatically creates the body and induction variable. To generate the body/iv, 'createBody' can be called on an AffineForOp with no body.
PiperOrigin-RevId: 232060516
Diffstat (limited to 'mlir/lib/EDSC/MLIREmitter.cpp')
-rw-r--r--mlir/lib/EDSC/MLIREmitter.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/mlir/lib/EDSC/MLIREmitter.cpp b/mlir/lib/EDSC/MLIREmitter.cpp
index dc85c5ed682..f4d5d36d25b 100644
--- a/mlir/lib/EDSC/MLIREmitter.cpp
+++ b/mlir/lib/EDSC/MLIREmitter.cpp
@@ -21,12 +21,14 @@
#include "llvm/Support/raw_ostream.h"
#include "mlir-c/Core.h"
+#include "mlir/AffineOps/AffineOps.h"
#include "mlir/Analysis/AffineAnalysis.h"
#include "mlir/EDSC/MLIREmitter.h"
#include "mlir/EDSC/Types.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Instructions.h"
+#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/Value.h"
#include "mlir/StandardOps/StandardOps.h"
@@ -133,8 +135,8 @@ static void printDefininingStatement(llvm::raw_ostream &os, const Value &v) {
inst->print(os);
return;
}
- if (auto *forInst = getForInductionVarOwner(&v)) {
- forInst->print(os);
+ if (auto forInst = getForInductionVarOwner(&v)) {
+ forInst->getInstruction()->print(os);
} else {
os << "unknown_ssa_value";
}
@@ -300,7 +302,9 @@ Value *mlir::edsc::MLIREmitter::emitExpr(Expr e) {
exprs[1]->getDefiningInst()->cast<ConstantIndexOp>()->getValue();
auto step =
exprs[2]->getDefiningInst()->cast<ConstantIndexOp>()->getValue();
- res = builder->createFor(location, lb, ub, step)->getInductionVar();
+ auto forOp = builder->create<AffineForOp>(location, lb, ub, step);
+ forOp->createBody();
+ res = forOp->getInductionVar();
}
}
OpenPOWER on IntegriCloud