summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDavid L Kreitzer <david.l.kreitzer@intel.com>2016-05-17 12:47:46 +0000
committerDavid L Kreitzer <david.l.kreitzer@intel.com>2016-05-17 12:47:46 +0000
commite7c583e06ffc9cc203da6ba20a463c84cc79dbe7 (patch)
treeca9b6f0b9986ce8cb3628ff72c7f83f9865e5d53 /llvm/lib/Target
parent75f8f6e1116901a0ce24e1c0159ef059a8518c18 (diff)
downloadbcm5719-llvm-e7c583e06ffc9cc203da6ba20a463c84cc79dbe7.tar.gz
bcm5719-llvm-e7c583e06ffc9cc203da6ba20a463c84cc79dbe7.zip
Fix for PR27750. Correctly handle the case where the fallthrough block and
target block are the same in getFallThroughMBB. Differential Revision: http://reviews.llvm.org/D20288 llvm-svn: 269760
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86InstrInfo.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 11c532c7d71..acf042f242f 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -3927,17 +3927,21 @@ bool X86InstrInfo::isUnpredicatedTerminator(const MachineInstr &MI) const {
return !isPredicated(MI);
}
-// Given a MBB and its TBB, find the FBB which was a fallthrough MBB (it may not
-// be a fallthorough MBB now due to layout changes). Return nullptr if the
-// fallthough MBB cannot be identified.
+// Given a MBB and its TBB, find the FBB which was a fallthrough MBB (it may
+// not be a fallthrough MBB now due to layout changes). Return nullptr if the
+// fallthrough MBB cannot be identified.
static MachineBasicBlock *getFallThroughMBB(MachineBasicBlock *MBB,
MachineBasicBlock *TBB) {
+ // Look for non-EHPad successors other than TBB. If we find exactly one, it
+ // is the fallthrough MBB. If we find zero, then TBB is both the target MBB
+ // and fallthrough MBB. If we find more than one, we cannot identify the
+ // fallthrough MBB and should return nullptr.
MachineBasicBlock *FallthroughBB = nullptr;
for (auto SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE; ++SI) {
- if ((*SI)->isEHPad() || *SI == TBB)
+ if ((*SI)->isEHPad() || (*SI == TBB && FallthroughBB))
continue;
// Return a nullptr if we found more than one fallthrough successor.
- if (FallthroughBB)
+ if (FallthroughBB && FallthroughBB != TBB)
return nullptr;
FallthroughBB = *SI;
}
OpenPOWER on IntegriCloud