Skip to content

Commit 47fa67a

Browse files
committed
prevent multiple map lookups
Signed-off-by: Nathan Gauër <[email protected]>
1 parent 35efc27 commit 47fa67a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Target/SPIRV/SPIRVStructurizer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,14 +620,14 @@ class SPIRVStructurizer : public FunctionPass {
620620
std::vector<Edge> Output;
621621

622622
for (auto &[Src, Dst] : Edges) {
623-
if (Seen.count(Src) == 0) {
624-
Seen.emplace(Src, Dst);
623+
auto [iterator, inserted] = Seen.insert({Src, Dst});
624+
if (inserted) {
625625
Output.emplace_back(Src, Dst);
626626
continue;
627627
}
628628

629629
// The exact same edge was already seen. Ignoring.
630-
if (Seen[Src] == Dst)
630+
if (iterator->second == Dst)
631631
continue;
632632

633633
// The same Src block branches to 2 distinct blocks. This will be an

0 commit comments

Comments
 (0)