summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Analysis
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-12-17 14:57:07 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-12-17 14:57:41 -0800
commit74278dd01e5713920a35f1c3e0731e535667c19a (patch)
tree3aa35ade367c4f86e092c52471346e6456e52aa0 /mlir/lib/Analysis
parent6fa3bd5b3e57806ffa34946bd36528f72bf06b58 (diff)
downloadbcm5719-llvm-74278dd01e5713920a35f1c3e0731e535667c19a.tar.gz
bcm5719-llvm-74278dd01e5713920a35f1c3e0731e535667c19a.zip
NFC: Use TypeSwitch to simplify existing code.
PiperOrigin-RevId: 286066371
Diffstat (limited to 'mlir/lib/Analysis')
-rw-r--r--mlir/lib/Analysis/MemRefBoundCheck.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/mlir/lib/Analysis/MemRefBoundCheck.cpp b/mlir/lib/Analysis/MemRefBoundCheck.cpp
index 52379c0a1d0..4696ce64c22 100644
--- a/mlir/lib/Analysis/MemRefBoundCheck.cpp
+++ b/mlir/lib/Analysis/MemRefBoundCheck.cpp
@@ -20,6 +20,7 @@
//
//===----------------------------------------------------------------------===//
+#include "mlir/ADT/TypeSwitch.h"
#include "mlir/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/AffineStructures.h"
#include "mlir/Analysis/Passes.h"
@@ -49,11 +50,9 @@ std::unique_ptr<OpPassBase<FuncOp>> mlir::createMemRefBoundCheckPass() {
void MemRefBoundCheck::runOnFunction() {
getFunction().walk([](Operation *opInst) {
- if (auto loadOp = dyn_cast<AffineLoadOp>(opInst)) {
- boundCheckLoadOrStoreOp(loadOp);
- } else if (auto storeOp = dyn_cast<AffineStoreOp>(opInst)) {
- boundCheckLoadOrStoreOp(storeOp);
- }
+ TypeSwitch<Operation *>(opInst).Case<AffineLoadOp, AffineStoreOp>(
+ [](auto op) { boundCheckLoadOrStoreOp(op); });
+
// TODO(bondhugula): do this for DMA ops as well.
});
}
OpenPOWER on IntegriCloud