summaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMBaseInstrInfo.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2013-07-16 22:01:40 +0000
committerLang Hames <lhames@gmail.com>2013-07-16 22:01:40 +0000
commit82d4215f64dc941f21bbae7ec781367d343387b8 (patch)
tree6ee20a6b4efb48a307305d4a08f6948919ea2f30 /lib/Target/ARM/ARMBaseInstrInfo.cpp
parent898788c6bcc2abfe0e1c7b21c14394352963acd6 (diff)
downloadllvm-82d4215f64dc941f21bbae7ec781367d343387b8.tar.gz
llvm-82d4215f64dc941f21bbae7ec781367d343387b8.tar.bz2
llvm-82d4215f64dc941f21bbae7ec781367d343387b8.tar.xz
Related to r181161 - Indirect branches may not be the last branch in a basic
block. Blocks that have an indirect branch terminator, even if it's not the last terminator, should still be treated as unanalyzable. <rdar://problem/14437274> Reducing a useful regression test case is proving difficult - I hope to have one soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMBaseInstrInfo.cpp')
-rw-r--r--lib/Target/ARM/ARMBaseInstrInfo.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMBaseInstrInfo.cpp b/lib/Target/ARM/ARMBaseInstrInfo.cpp
index d6701782a4..5d012fcc02 100644
--- a/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -295,6 +295,11 @@ ARMBaseInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
if (!isUnpredicatedTerminator(I))
return false;
+ // Check whether the second-to-last branch is indirect, return
+ // 'unanalyzeable' here too.
+ if (I != MBB.begin() && prior(I)->isIndirectBranch())
+ return true;
+
// If there is only one terminator instruction, process it.
if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) {
if (isUncondBranchOpcode(LastOpc)) {
@@ -322,6 +327,8 @@ ARMBaseInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
LastInst->eraseFromParent();
LastInst = SecondLastInst;
LastOpc = LastInst->getOpcode();
+ if (I != MBB.begin() && prior(I)->isIndirectBranch())
+ return true; // Indirect branches are unanalyzeable.
if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) {
// Return now the only terminator is an unconditional branch.
TBB = LastInst->getOperand(0).getMBB();