[BOLT] Do not assign a LP to tail calls

Summary:
Do not assign a LP to tail calls. They are not calls in the
view of an unwinder, they are just regular branches. We were hitting an
assertion in BinaryFunction::removeConditionalTailCalls() complaining
about landing pads in a CTC, however it was in fact a
builtin_unreachable being conservatively treated as a CTC.

(cherry picked from FBD6564957)
This commit is contained in:
Rafael Auler
2017-12-13 19:08:43 -08:00
committed by Maksim Panchenko
parent 660daac2d0
commit 1fa80594cf

View File

@@ -242,7 +242,8 @@ void BinaryFunction::parseLSDA(ArrayRef<uint8_t> LSDASectionData,
assert(II != IE && "exception range not pointing to an instruction");
do {
auto &Instruction = II->second;
if (BC.MIA->isCall(Instruction)) {
if (BC.MIA->isCall(Instruction) &&
!BC.MIA->getConditionalTailCall(Instruction)) {
assert(!BC.MIA->isInvoke(Instruction) &&
"overlapping exception ranges detected");
// Add extra operands to a call instruction making it an invoke from
@@ -553,7 +554,7 @@ void BinaryFunction::emitLSDA(MCStreamer *Streamer, bool EmitColdPart) {
if (!LPSymbol) {
Streamer->EmitIntValue(0, 4);
return;
}
}
Streamer->EmitValue(MCBinaryExpr::createSub(
MCSymbolRefExpr::create(LPSymbol, *BC.Ctx.get()),
LPStartExpr,
@@ -566,7 +567,7 @@ void BinaryFunction::emitLSDA(MCStreamer *Streamer, bool EmitColdPart) {
if (!LPSymbol) {
Streamer->EmitIntValue(0, 4);
return;
}
}
Streamer->emitAbsoluteSymbolDiff(LPSymbol, StartSymbol, 4);
};
}