Skip to content

Commit f6cbd7a

Browse files
committed
[llvm-profgen] Fix warnings when building without asserts [NFC]
Building without asserts we got: ../tools/llvm-profgen/ProfiledBinary.cpp:627:14: error: unused variable 'Err' [-Werror,-Wunused-variable] 627 | bool Err = MIA->evaluateBranch(Inst, Address, Size, Target); | ^~~ ../tools/llvm-profgen/ProfiledBinary.cpp:1172:14: error: unused variable 'TopProbe' [-Werror,-Wunused-variable] 1172 | auto TopProbe = TopLevelProbes.begin(); | ^~~~~~~~ 2 errors generated. Add [[maybe_unused]] to the variables just used in asserts.
1 parent 11b1bd5 commit f6cbd7a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/tools/llvm-profgen/ProfiledBinary.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,8 @@ bool ProfiledBinary::dissassembleSymbol(std::size_t SI, ArrayRef<uint8_t> Bytes,
624624
// Record potential call targets for tail frame inference later-on.
625625
if (InferMissingFrames && FRange) {
626626
uint64_t Target = 0;
627-
bool Err = MIA->evaluateBranch(Inst, Address, Size, Target);
627+
[[maybe_unused]] bool Err =
628+
MIA->evaluateBranch(Inst, Address, Size, Target);
628629
if (MCDesc.isCall()) {
629630
// Indirect call targets are unknown at this point. Recording the
630631
// unknown target (zero) for further LBR-based refinement.
@@ -1169,7 +1170,7 @@ void ProfiledBinary::loadSymbolsFromPseudoProbe() {
11691170
InlineTreeNode->Parent);
11701171

11711172
auto TopLevelProbes = InlineTreeNode->getProbes();
1172-
auto TopProbe = TopLevelProbes.begin();
1173+
[[maybe_unused]] auto TopProbe = TopLevelProbes.begin();
11731174
assert(TopProbe != TopLevelProbes.end() &&
11741175
TopProbe->getAddress() >= StartAddr &&
11751176
TopProbe->getAddress() < EndAddr &&

0 commit comments

Comments
 (0)