[llvm] [StructurizeCFG] Avoid repeated hash lookups (NFC) (PR #107797)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 8 18:57:10 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/107797
None
>From 35dba4014845fde50a6573971424f1692cd5eb0a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 8 Sep 2024 10:02:21 -0700
Subject: [PATCH] [StructurizeCFG] Avoid repeated hash lookups (NFC)
---
llvm/lib/Transforms/Scalar/StructurizeCFG.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
index a6ed58ac9d47f2..aca8225cebb3fd 100644
--- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -697,10 +697,9 @@ void StructurizeCFG::findUndefBlocks(
// undefined value for the PHI being reconstructed.
while (!Stack.empty()) {
BasicBlock *Current = Stack.pop_back_val();
- if (VisitedBlock.contains(Current))
+ if (!VisitedBlock.insert(Current).second)
continue;
- VisitedBlock.insert(Current);
if (FlowSet.contains(Current)) {
for (auto P : predecessors(Current))
Stack.push_back(P);
More information about the llvm-commits
mailing list