[MLIR] Sketch AffineExpr value type
This CL sketches what it takes for AffineExpr to fully have by-value semantics
and not be a not-so-smart pointer anymore.
This essentially makes the underyling class a simple storage struct and
implements the operations on the value type directly. Since there is no
forwarding of operations anymore, we can full isolate the storage class and
make a hard visibility barrier by moving detail::AffineExpr into
AffineExprDetail.h.
AffineExprDetail.h is only included where storage-related information is
needed.
PiperOrigin-RevId: 216385459
diff --git a/lib/Analysis/LoopAnalysis.cpp b/lib/Analysis/LoopAnalysis.cpp
index b3e3afe..cb63de3 100644
--- a/lib/Analysis/LoopAnalysis.cpp
+++ b/lib/Analysis/LoopAnalysis.cpp
@@ -64,7 +64,7 @@
auto cExpr = loopSpanExpr.dyn_cast<AffineConstantExpr>();
if (!cExpr)
return loopSpanExpr.ceilDiv(step);
- loopSpan = cExpr->getValue();
+ loopSpan = cExpr.getValue();
}
// 0 iteration loops.
@@ -85,7 +85,7 @@
return None;
if (auto constExpr = tripCountExpr.dyn_cast<AffineConstantExpr>())
- return constExpr->getValue();
+ return constExpr.getValue();
return None;
}
@@ -100,7 +100,7 @@
return 1;
if (auto constExpr = tripCountExpr.dyn_cast<AffineConstantExpr>()) {
- uint64_t tripCount = constExpr->getValue();
+ uint64_t tripCount = constExpr.getValue();
// 0 iteration loops (greatest divisor is 2^64 - 1).
if (tripCount == 0)
@@ -111,5 +111,5 @@
}
// Trip count is not a known constant; return its largest known divisor.
- return tripCountExpr->getLargestKnownDivisor();
+ return tripCountExpr.getLargestKnownDivisor();
}