Skip to content

Commit e4a6e2e

Browse files
authored
[NFC][IR] Remove redundant .empty() check (#130352)
Preparation for CFI Index refactoring, which will fix O(N^2) in ThinLTO indexing.
1 parent 356bbb0 commit e4a6e2e

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5064,33 +5064,29 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
50645064
getReferencedTypeIds(FS, ReferencedTypeIds);
50655065
}
50665066

5067-
if (!Index.cfiFunctionDefs().empty()) {
5068-
for (auto &S : Index.cfiFunctionDefs()) {
5069-
if (DefOrUseGUIDs.contains(
5070-
GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) {
5071-
NameVals.push_back(StrtabBuilder.add(S));
5072-
NameVals.push_back(S.size());
5073-
}
5074-
}
5075-
if (!NameVals.empty()) {
5076-
Stream.EmitRecord(bitc::FS_CFI_FUNCTION_DEFS, NameVals);
5077-
NameVals.clear();
5067+
for (auto &S : Index.cfiFunctionDefs()) {
5068+
if (DefOrUseGUIDs.contains(
5069+
GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) {
5070+
NameVals.push_back(StrtabBuilder.add(S));
5071+
NameVals.push_back(S.size());
50785072
}
50795073
}
5074+
if (!NameVals.empty()) {
5075+
Stream.EmitRecord(bitc::FS_CFI_FUNCTION_DEFS, NameVals);
5076+
NameVals.clear();
5077+
}
50805078

5081-
if (!Index.cfiFunctionDecls().empty()) {
5082-
for (auto &S : Index.cfiFunctionDecls()) {
5083-
if (DefOrUseGUIDs.contains(
5084-
GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) {
5085-
NameVals.push_back(StrtabBuilder.add(S));
5086-
NameVals.push_back(S.size());
5087-
}
5088-
}
5089-
if (!NameVals.empty()) {
5090-
Stream.EmitRecord(bitc::FS_CFI_FUNCTION_DECLS, NameVals);
5091-
NameVals.clear();
5079+
for (auto &S : Index.cfiFunctionDecls()) {
5080+
if (DefOrUseGUIDs.contains(
5081+
GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) {
5082+
NameVals.push_back(StrtabBuilder.add(S));
5083+
NameVals.push_back(S.size());
50925084
}
50935085
}
5086+
if (!NameVals.empty()) {
5087+
Stream.EmitRecord(bitc::FS_CFI_FUNCTION_DECLS, NameVals);
5088+
NameVals.clear();
5089+
}
50945090

50955091
// Walk the GUIDs that were referenced, and write the
50965092
// corresponding type id records.

0 commit comments

Comments
 (0)