HomePhabricator

[Spectre] Fix MIR verifier errors in retpoline thunks

Authored by rnk on Oct 26 2018, 1:26 PM.

Description

[Spectre] Fix MIR verifier errors in retpoline thunks

Summary:
The main challenge here is that X86InstrInfo::AnalyzeBranch doesn't
understand the way we're using a CALL instruction as a branch, so we
can't list the CallTarget MBB as a successor of the entry block. If we
don't list it as a successor, then the AsmPrinter doesn't print a label
for the MBB.

Fix the issue by inserting our own label at the beginning of the call
target block. We can rely on the AsmPrinter to always emit it, even
though the block appears to be unreachable, but address-taken.

Fixes PR38391.

Reviewers: thegameg, chandlerc, echristo

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D53653

llvm-svn: 345426

Details

Committed
rnkOct 26 2018, 1:26 PM
Differential Revision
D53653: [Spectre] Fix MIR verifier errors in retpoline thunks
Parents
rGe2ec68e17771: Work around gcc.gnu.org/PR87766
Branches
Unknown
Tags
Unknown