[llvm] 9886f21 - [MSP430] Recognize Bi as an indirect branch in analyzeBranch. NFC.

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 29 08:43:16 PDT 2021


Author: Jay Foad
Date: 2021-09-29T16:43:11+01:00
New Revision: 9886f21bc138217b3ca3549bd8bd96d6b70d92f6

URL: https://github.com/llvm/llvm-project/commit/9886f21bc138217b3ca3549bd8bd96d6b70d92f6
DIFF: https://github.com/llvm/llvm-project/commit/9886f21bc138217b3ca3549bd8bd96d6b70d92f6.diff

LOG: [MSP430] Recognize Bi as an indirect branch in analyzeBranch. NFC.

Recognize Bi as an unconditional branch, just like JMP. This allows
machine verification to run after MSP430BranchSelector without failing
this assertion:

virtual bool llvm::MSP430InstrInfo::analyzeBranch(llvm::MachineBasicBlock &, llvm::MachineBasicBlock *&, llvm::MachineBasicBlock *&, SmallVectorImpl<llvm::MachineOperand> &, bool) const: Assertion `I->getOpcode() == MSP430::JCC && "Invalid conditional branch"' failed.

Note that machine verification is currently disabled after
addPreEmitPass passes because of problems on other targets, so this is
currently NFC.

Differential Revision: https://reviews.llvm.org/D110691

Added: 
    

Modified: 
    llvm/lib/Target/MSP430/MSP430InstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/MSP430/MSP430InstrInfo.cpp b/llvm/lib/Target/MSP430/MSP430InstrInfo.cpp
index 130211878be17..6c147e700b8c6 100644
--- a/llvm/lib/Target/MSP430/MSP430InstrInfo.cpp
+++ b/llvm/lib/Target/MSP430/MSP430InstrInfo.cpp
@@ -116,6 +116,7 @@ unsigned MSP430InstrInfo::removeBranch(MachineBasicBlock &MBB,
       continue;
     if (I->getOpcode() != MSP430::JMP &&
         I->getOpcode() != MSP430::JCC &&
+        I->getOpcode() != MSP430::Bi &&
         I->getOpcode() != MSP430::Br &&
         I->getOpcode() != MSP430::Bm)
       break;
@@ -189,7 +190,7 @@ bool MSP430InstrInfo::analyzeBranch(MachineBasicBlock &MBB,
       return true;
 
     // Handle unconditional branches.
-    if (I->getOpcode() == MSP430::JMP) {
+    if (I->getOpcode() == MSP430::JMP || I->getOpcode() == MSP430::Bi) {
       if (!AllowModify) {
         TBB = I->getOperand(0).getMBB();
         continue;


        


More information about the llvm-commits mailing list