summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR
diff options
context:
space:
mode:
authorUday Bondhugula <udayb@iisc.ac.in>2019-11-07 10:26:51 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-11-07 10:27:27 -0800
commiteb47d5ee66e2e3dc4d9f2fc7768c41f6b037f3db (patch)
treeea757718c77bb5ff0c49a319f23909ce73f3e4dd /mlir/lib/IR
parent8f00b4494d0434eedd8c80917d17d33d395ea65d (diff)
downloadbcm5719-llvm-eb47d5ee66e2e3dc4d9f2fc7768c41f6b037f3db.tar.gz
bcm5719-llvm-eb47d5ee66e2e3dc4d9f2fc7768c41f6b037f3db.zip
Fix asm printer for affine expr
- fixes tensorflow/mlir#201 Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#204 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/204 from bondhugula:printfix 3f8a5b65391f45598258b2735fecaa409fbde848 PiperOrigin-RevId: 279115720
Diffstat (limited to 'mlir/lib/IR')
-rw-r--r--mlir/lib/IR/AsmPrinter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 0d0c40cdd1e..43452b2712d 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -1182,9 +1182,12 @@ void ModulePrinter::printAffineExprInternal(
// Pretty print multiplication with -1.
auto rhsConst = rhsExpr.dyn_cast<AffineConstantExpr>();
- if (rhsConst && rhsConst.getValue() == -1) {
+ if (rhsConst && binOp.getKind() == AffineExprKind::Mul &&
+ rhsConst.getValue() == -1) {
os << "-";
printAffineExprInternal(lhsExpr, BindingStrength::Strong, printValueName);
+ if (enclosingTightness == BindingStrength::Strong)
+ os << ')';
return;
}
OpenPOWER on IntegriCloud