]> granicus.if.org Git - llvm/commitdiff
[SystemZ] Call erase() on the right MBB in SystemZTargetLowering::emitSelect()
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>
Mon, 16 Sep 2019 14:49:36 +0000 (14:49 +0000)
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>
Mon, 16 Sep 2019 14:49:36 +0000 (14:49 +0000)
Since MBB was split *before* MI, the MI(s) will reside in JoinMBB (MBB) at
the point of erasing them, so calling StartMBB->erase() is actually wrong,
although it is "working" by all appearances.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371995 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SystemZ/SystemZISelLowering.cpp

index ce1582157e9d2c08764cbd3cbde117dfdbbaeeb8..f79f40cc6c33f290a2430f11b087ab66942b543c 100644 (file)
@@ -6678,7 +6678,7 @@ SystemZTargetLowering::emitSelect(MachineInstr &MI,
       std::next(MachineBasicBlock::iterator(LastMI)), MBB->end());
   createPHIsForSelects(MIItBegin, MIItEnd, StartMBB, FalseMBB, MBB);
 
-  StartMBB->erase(MIItBegin, MIItEnd);
+  MBB->erase(MIItBegin, MIItEnd);
   return JoinMBB;
 }