summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorOliver Stannard <oliver.stannard@arm.com>2019-02-05 17:21:57 +0000
committerOliver Stannard <oliver.stannard@arm.com>2019-02-05 17:21:57 +0000
commit78dc38ec94229f38c5de74a8930eed623a27350e (patch)
tree5ef63989b98172554367e73e48f42ee984577bd1 /llvm/lib
parent822d2e35e7729ea844580152ff635262d2cf44e9 (diff)
downloadbcm5719-llvm-78dc38ec94229f38c5de74a8930eed623a27350e.tar.gz
bcm5719-llvm-78dc38ec94229f38c5de74a8930eed623a27350e.zip
[AArch64][Outliner] Don't outline BTI instructions
We can't outline BTI instructions, because they need to be the very first instruction executed after an indirect call or branch. If we outline them, then an indirect call might go to the branch to the outlined function, which will fault. Differential revision: https://reviews.llvm.org/D57753 llvm-svn: 353190
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstrInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index 4996f1c1764..e2018ab7578 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -5330,6 +5330,14 @@ AArch64InstrInfo::getOutliningType(MachineBasicBlock::iterator &MIT,
MI.modifiesRegister(AArch64::W30, &getRegisterInfo()))
return outliner::InstrType::Illegal;
+ // Don't outline BTI instructions, because that will prevent the outlining
+ // site from being indirectly callable.
+ if (MI.getOpcode() == AArch64::HINT) {
+ int64_t Imm = MI.getOperand(0).getImm();
+ if (Imm == 32 || Imm == 34 || Imm == 36 || Imm == 38)
+ return outliner::InstrType::Illegal;
+ }
+
return outliner::InstrType::Legal;
}
OpenPOWER on IntegriCloud