summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-08-17 00:34:00 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-08-17 00:34:00 +0000
commite04fe1a39404394ace7616aba3ce0f5c378292fb (patch)
tree581b358041188c191189f3af31f7ab6c9aa064c9 /llvm/lib/Target
parent3bbeb735eda1369efffe3d8bc792927e0ed1fdec (diff)
downloadbcm5719-llvm-e04fe1a39404394ace7616aba3ce0f5c378292fb.tar.gz
bcm5719-llvm-e04fe1a39404394ace7616aba3ce0f5c378292fb.zip
Hexagon: Avoid dereferencing end() in HexagonInstrInfo::InsertBranch
llvm-svn: 278878
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
index d3c038a44cd..c148b9caddc 100644
--- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
@@ -582,13 +582,11 @@ unsigned HexagonInstrInfo::InsertBranch(MachineBasicBlock &MBB,
SmallVector<MachineOperand, 4> Cond;
auto Term = MBB.getFirstTerminator();
if (Term != MBB.end() && isPredicated(*Term) &&
- !analyzeBranch(MBB, NewTBB, NewFBB, Cond, false)) {
- MachineBasicBlock *NextBB = &*++MBB.getIterator();
- if (NewTBB == NextBB) {
- ReverseBranchCondition(Cond);
- RemoveBranch(MBB);
- return InsertBranch(MBB, TBB, nullptr, Cond, DL);
- }
+ !analyzeBranch(MBB, NewTBB, NewFBB, Cond, false) &&
+ MachineFunction::iterator(NewTBB) == ++MBB.getIterator()) {
+ ReverseBranchCondition(Cond);
+ RemoveBranch(MBB);
+ return InsertBranch(MBB, TBB, nullptr, Cond, DL);
}
BuildMI(&MBB, DL, get(BOpc)).addMBB(TBB);
} else if (isEndLoopN(Cond[0].getImm())) {
OpenPOWER on IntegriCloud