Skip to content

Commit c097d37

Browse files
committed
Fix branch target check when an instruction branches to itself. (i.e. jmp 0)
1 parent 0fd352d commit c097d37

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/tools/llvm-profgen/ProfiledBinary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,13 +606,13 @@ bool ProfiledBinary::dissassembleSymbol(std::size_t SI, ArrayRef<uint8_t> Bytes,
606606
// Record potential call targets for tail frame inference later-on.
607607
if (InferMissingFrames && FRange) {
608608
uint64_t Target = 0;
609-
MIA->evaluateBranch(Inst, Address, Size, Target);
609+
bool Err = MIA->evaluateBranch(Inst, Address, Size, Target);
610610
if (MCDesc.isCall()) {
611611
// Indirect call targets are unknown at this point. Recording the
612612
// unknown target (zero) for further LBR-based refinement.
613613
MissingContextInferrer->CallEdges[Address].insert(Target);
614614
} else if (MCDesc.isUnconditionalBranch()) {
615-
assert(Target &&
615+
assert(Err &&
616616
"target should be known for unconditional direct branch");
617617
// Any inter-function unconditional jump is considered tail call at
618618
// this point. This is not 100% accurate and could further be

0 commit comments

Comments
 (0)