Skip to content

Commit bd08a87

Browse files
committed
[EHStreamer] Simplify sharedTypeIDs with std::mismatch
(Note that EMStreamer.cpp is largely under tested. The only test checking the prefix sharing is CodeGen/WebAssembly/eh-lsda.ll)
1 parent a975be0 commit bd08a87

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,9 @@ EHStreamer::~EHStreamer() = default;
4444
unsigned EHStreamer::sharedTypeIDs(const LandingPadInfo *L,
4545
const LandingPadInfo *R) {
4646
const std::vector<int> &LIds = L->TypeIds, &RIds = R->TypeIds;
47-
unsigned LSize = LIds.size(), RSize = RIds.size();
48-
unsigned MinSize = LSize < RSize ? LSize : RSize;
49-
unsigned Count = 0;
50-
51-
for (; Count != MinSize; ++Count)
52-
if (LIds[Count] != RIds[Count])
53-
return Count;
54-
55-
return Count;
47+
return std::mismatch(LIds.begin(), LIds.end(), RIds.begin(), RIds.end())
48+
.first -
49+
LIds.begin();
5650
}
5751

5852
/// Compute the actions table and gather the first action index for each landing

0 commit comments

Comments
 (0)