[Mlir-commits] [mlir] 6f52c1e - [OpenACC] Avoid repeated hash lookups (NFC) (#108795)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Sep 16 06:44:02 PDT 2024
Author: Kazu Hirata
Date: 2024-09-16T06:43:58-07:00
New Revision: 6f52c1e6b131f79abd47d692b1f597046efb2b6b
URL: https://github.com/llvm/llvm-project/commit/6f52c1e6b131f79abd47d692b1f597046efb2b6b
DIFF: https://github.com/llvm/llvm-project/commit/6f52c1e6b131f79abd47d692b1f597046efb2b6b.diff
LOG: [OpenACC] Avoid repeated hash lookups (NFC) (#108795)
Added:
Modified:
mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
index b4da50443c6cc9..877bd226a03528 100644
--- a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
+++ b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
@@ -1790,9 +1790,8 @@ bool hasDuplicateDeviceTypes(
return false;
for (auto attr : *segments) {
auto deviceTypeAttr = mlir::dyn_cast<mlir::acc::DeviceTypeAttr>(attr);
- if (deviceTypes.contains(deviceTypeAttr.getValue()))
+ if (!deviceTypes.insert(deviceTypeAttr.getValue()).second)
return true;
- deviceTypes.insert(deviceTypeAttr.getValue());
}
return false;
}
@@ -1807,9 +1806,8 @@ LogicalResult checkDeviceTypes(mlir::ArrayAttr deviceTypes) {
mlir::dyn_cast_or_null<mlir::acc::DeviceTypeAttr>(attr);
if (!deviceTypeAttr)
return failure();
- if (crtDeviceTypes.contains(deviceTypeAttr.getValue()))
+ if (!crtDeviceTypes.insert(deviceTypeAttr.getValue()).second)
return failure();
- crtDeviceTypes.insert(deviceTypeAttr.getValue());
}
return success();
}
More information about the Mlir-commits
mailing list