diff options
author | Sylvain Audi <sylvain.audi@ubisoft.com> | 2022-11-04 16:34:23 -0400 |
---|---|---|
committer | Sylvain Audi <sylvain.audi@ubisoft.com> | 2022-11-30 07:29:54 -0500 |
commit | 3f3438a596d4883ecd934fc725a9d5f620082c3b (patch) | |
tree | a4845b53a8c5c4a47897afbbcb6262f5393c10ec /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | a88deb4b65f842138813334a77bbcecf8cfb9aaf (diff) | |
download | llvm-3f3438a596d4883ecd934fc725a9d5f620082c3b.zip llvm-3f3438a596d4883ecd934fc725a9d5f620082c3b.tar.gz llvm-3f3438a596d4883ecd934fc725a9d5f620082c3b.tar.bz2 |
[CodeGen][X86] Crash fixes for "patchable-function" pass
This patch fixes crashes related with how PatchableFunction selects the instruction to make patchable:
- Ensure PatchableFunction skips all instructions that don't generate actual machine instructions.
- Handle the case where the first MachineBasicBlock is empty
- Removed support for 16 bit x86 architectures.
Note: another issue remains related with PatchableFunction, in the lowering part.
See https://github.com/llvm/llvm-project/issues/59039
Differential Revision: https://reviews.llvm.org/D137642
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 9a1ae23..3686c94 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -885,7 +885,9 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // backends as they don't need it -- instructions on these architectures are // always atomically patchable at runtime. if (CGM.getCodeGenOpts().HotPatch && - getContext().getTargetInfo().getTriple().isX86()) + getContext().getTargetInfo().getTriple().isX86() && + getContext().getTargetInfo().getTriple().getEnvironment() != + llvm::Triple::CODE16) Fn->addFnAttr("patchable-function", "prologue-short-redirect"); // Add no-jump-tables value. |