summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR
diff options
context:
space:
mode:
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