[MachineOutliner] Don't outline functions starting with PATCHABLE_FUNCTION_ENTER...
authorFangrui Song <i@maskray.me>
Mon, 13 Dec 2021 21:24:29 +0000 (13:24 -0800)
committerFangrui Song <i@maskray.me>
Mon, 13 Dec 2021 21:24:29 +0000 (13:24 -0800)
commita6a07a514b8a084feaa7f4f15d569698b9840d83
treee04efbc760de5925306f24ba724abf31ab23be57
parentf2120328e81879bf14d2a5c381749a11577fa304
[MachineOutliner] Don't outline functions starting with PATCHABLE_FUNCTION_ENTER/FENTRL_CALL

MachineOutliner may outline a "patchable-function-entry" function whose body has
a TargetOpcode::PATCHABLE_FUNCTION_ENTER MachineInstr. This is incorrect because
the special code sequence must stay unchanged to be used at run-time.
Avoid outlining PATCHABLE_FUNCTION_ENTER. While here, avoid outlining FENTRY_CALL too
(which doesn't reproduce currently) to allow phase ordering flexibility.

Fixes #52635

Reviewed By: paquette

Differential Revision: https://reviews.llvm.org/D115614
llvm/include/llvm/CodeGen/TargetInstrInfo.h
llvm/lib/CodeGen/TargetInstrInfo.cpp
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
llvm/test/CodeGen/AArch64/machine-outliner-patchable.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/machine-outliner-patchable.ll [new file with mode: 0644]