Disappearing Machine Basic Blocks (for new instruction)

I have a new instruction that takes 2 labels, and in SelectionDAGISel,
I have it doing "CurMBB->addSuccessor()" for both machine blocks. The
DAG node it creates also takes both blocks as SDOperands.

When I lower to x86, the not-fallthrough block disappears. If I run
llc with --fast, the blocks stay around, so it must be an optimization
pass of some sort that doesn't realize my new instruction is

How do I tell LLVM to not delete the target blocks of my instruction?

Here's a list of files I've modified so far:
M llvm-2.3/include/llvm/CodeGen/SelectionDAGNodes.h
M llvm-2.3/include/llvm/Instruction.def
M llvm-2.3/include/llvm/Instructions.h
M llvm-2.3/include/llvm/Support/InstVisitor.h
M llvm-2.3/lib/AsmParser/LLLexer.cpp
M llvm-2.3/lib/AsmParser/llvmAsmParser.cpp.cvs
M llvm-2.3/lib/AsmParser/llvmAsmParser.h.cvs
M llvm-2.3/lib/AsmParser/llvmAsmParser.y
M llvm-2.3/lib/AsmParser/llvmAsmParser.y.cvs
M llvm-2.3/lib/Bitcode/Reader/BitcodeReader.cpp
M llvm-2.3/lib/Bitcode/Writer/BitcodeWriter.cpp
M llvm-2.3/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
M llvm-2.3/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
M llvm-2.3/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
M llvm-2.3/lib/Target/TargetSelectionDAG.td
M llvm-2.3/lib/Target/X86/X86InstrInfo.td
M llvm-2.3/lib/VMCore/Instruction.cpp
M llvm-2.3/lib/VMCore/Instructions.cpp


For anyone to have any shot of answering your question, you need to provide more information. To start, please figure out which pass deleted the block, what does the machine function looks like before and after.


It seems like it was MachineBasicBlock::CorrectExtraCFGEdges that
eventually removed the successor link, and that method was
conditionally called after checking X86InstrInfo::AnalyzeBranch in the
branch folder.

Setting my instruction to be branch-like in X86InstrInfo.td makes the
2 target blocks stay around.