1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00

[CSSPGO][llvm-profgen] Handle return to external transition.

In a callback case, a return from internal code, say A, to external runtime can happen. The external runtime can then call back to another internal routine, say B. Making an artificial branch that looks like a return from A to B can confuse the unwinder to treat the instruction before B as the call instruction.

Reviewed By: wenlei, wmi

Differential Revision: https://reviews.llvm.org/D104546
This commit is contained in:
Hongtao Yu 2021-06-18 09:30:38 -07:00
parent ae4432a64d
commit c6ff0d26c8

View File

@ -460,6 +460,16 @@ bool PerfReader::extractLBRStack(TraceStream &TraceIt,
// they are likely in different contexts.
break;
}
if (Binary->addressIsReturn(Src)) {
// In a callback case, a return from internal code, say A, to external
// runtime can happen. The external runtime can then call back to
// another internal routine, say B. Making an artificial branch that
// looks like a return from A to B can confuse the unwinder to treat
// the instruction before B as the call instruction.
break;
}
// For transition to external code, group the Source with the next
// availabe transition target.
Dst = PrevTrDst;