[llvm] [TableGen] Avoid repeated hash lookups (NFC) (PR #107710)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 7 10:17:10 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-directx
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/107710.diff
1 Files Affected:
- (modified) llvm/utils/TableGen/DXILEmitter.cpp (+2-4)
``````````diff
diff --git a/llvm/utils/TableGen/DXILEmitter.cpp b/llvm/utils/TableGen/DXILEmitter.cpp
index 9cc1b5ccb8acb9..39b4a3ac375ed6 100644
--- a/llvm/utils/TableGen/DXILEmitter.cpp
+++ b/llvm/utils/TableGen/DXILEmitter.cpp
@@ -402,10 +402,8 @@ static void emitDXILOperationTable(std::vector<DXILOperationDesc> &Ops,
for (auto &Op : Ops) {
OpStrings.add(Op.OpName);
- if (ClassSet.contains(Op.OpClass))
- continue;
- ClassSet.insert(Op.OpClass);
- OpClassStrings.add(Op.OpClass.data());
+ if (ClassSet.insert(Op.OpClass).second)
+ OpClassStrings.add(Op.OpClass.data());
}
// Layout names.
``````````
</details>
https://github.com/llvm/llvm-project/pull/107710
More information about the llvm-commits
mailing list