TailDuplicator: Fix crash after r278974
authorMatthias Braun <matze@braunis.de>
Thu, 18 Aug 2016 00:59:32 +0000 (00:59 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 18 Aug 2016 00:59:32 +0000 (00:59 +0000)
Some inputs would after r278974 without this fix (see
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_build/2733/console
for an example)

llvm-svn: 279022

llvm/lib/CodeGen/TailDuplicator.cpp

index a93d13c..2d0b1ac 100644 (file)
@@ -673,7 +673,7 @@ bool TailDuplicator::duplicateSimpleBB(
                  << "From simple Succ: " << *TailBB);
 
     MachineBasicBlock *NewTarget = *TailBB->succ_begin();
-    MachineBasicBlock *NextBB = &*std::next(PredBB->getIterator());
+    MachineBasicBlock *NextBB = PredBB->getNextNode();
 
     // Make PredFBB explicit.
     if (PredCond.empty())