[llvm] r345821 - [Mips] Conditionally remove successor block
    Stefan Maksimovic via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Nov  1 03:10:43 PDT 2018
    
    
  
Author: smaksimovic
Date: Thu Nov  1 03:10:42 2018
New Revision: 345821
URL: http://llvm.org/viewvc/llvm-project?rev=345821&view=rev
Log:
[Mips] Conditionally remove successor block
In MipsBranchExpansion::splitMBB, upon splitting
a block with two direct branches, remove the successor
of the newly created block (which inherits successors from
the original block) which is pointed to by the last
branch in the original block only if the targets of two
branches differ.
This is to fix the failing test when ran with
-verify-machineinstrs enabled.
Differential Revision: https://reviews.llvm.org/D53756
Modified:
    llvm/trunk/lib/Target/Mips/MipsBranchExpansion.cpp
    llvm/trunk/test/CodeGen/Mips/micromips-mtc-mfc.ll
Modified: llvm/trunk/lib/Target/Mips/MipsBranchExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsBranchExpansion.cpp?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsBranchExpansion.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsBranchExpansion.cpp Thu Nov  1 03:10:42 2018
@@ -271,7 +271,8 @@ void MipsBranchExpansion::splitMBB(Machi
   // Insert NewMBB and fix control flow.
   MachineBasicBlock *Tgt = getTargetMBB(*FirstBr);
   NewMBB->transferSuccessors(MBB);
-  NewMBB->removeSuccessor(Tgt, true);
+  if (Tgt != getTargetMBB(*LastBr))
+    NewMBB->removeSuccessor(Tgt, true);
   MBB->addSuccessor(NewMBB);
   MBB->addSuccessor(Tgt);
   MFp->insert(std::next(MachineFunction::iterator(MBB)), NewMBB);
Modified: llvm/trunk/test/CodeGen/Mips/micromips-mtc-mfc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/micromips-mtc-mfc.ll?rev=345821&r1=345820&r2=345821&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/micromips-mtc-mfc.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/micromips-mtc-mfc.ll Thu Nov  1 03:10:42 2018
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -mtriple=mips -mcpu=mips32r2 -mattr=+micromips \
+; RUN: llc -mtriple=mips -mcpu=mips32r2 -mattr=+micromips -verify-machineinstrs \
 ; RUN:     -show-mc-encoding < %s | FileCheck --check-prefix=MM2 %s
-; RUN: llc -mtriple=mips -mcpu=mips32r6 -mattr=+micromips \
+; RUN: llc -mtriple=mips -mcpu=mips32r6 -mattr=+micromips -verify-machineinstrs \
 ; RUN:     -show-mc-encoding < %s | FileCheck --check-prefix=MM6 %s
 
 define double @foo(double %a, double %b) {
    
    
More information about the llvm-commits
mailing list