Edward Lee
2008-Sep-19 23:14 UTC
[LLVMdev] 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 branch-like. 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 Ed
Evan Cheng
2008-Sep-20 00:11 UTC
[LLVMdev] Disappearing Machine Basic Blocks (for new instruction)
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. Evan On Sep 19, 2008, at 4:14 PM, Edward Lee wrote:> 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 > branch-like. > > 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 > > Ed > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Edward Lee
2008-Sep-21 23:46 UTC
[LLVMdev] Disappearing Machine Basic Blocks (for new instruction)
On Fri, Sep 19, 2008 at 7:11 PM, Evan Cheng <evan.cheng at apple.com> wrote:> please figure out which pass deleted the blockIt 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. Ed
Possibly Parallel Threads
- [LLVMdev] Disappearing Machine Basic Blocks (for new instruction)
- [LLVMdev] Build failure on x86_64
- [LLVMdev] Re: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.cpp Lexer.l
- [LLVMdev] Re: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.cpp Lexer.l
- [LLVMdev] Re: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.cpp Lexer.l