summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commit57a113eb0d8b9e34c583535c3fa876e289e54c04 (patch)
tree34f2b86b4da9ee0ef6aed9b30c4006a13a9094ff /llvm/lib
parent2bc3dda186bc645f978c78942e85a2f0ba5d3859 (diff)
downloadbcm5719-llvm-57a113eb0d8b9e34c583535c3fa876e289e54c04.tar.gz
bcm5719-llvm-57a113eb0d8b9e34c583535c3fa876e289e54c04.zip
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. llvm-svn: 186461
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index d6701782a47..5d012fcc021 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud