Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGISel.cpp updated: 1.225 -> 1.226 --- Log message: Fix the updating of the machine CFG when a PHI node was in a successor of the jump table's range check block. This re-enables 100% dense jump tables by default on PPC & x86 --- Diffs of the changes: (+10 -5) SelectionDAGISel.cpp | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.225 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.226 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.225 Sat Apr 22 18:51:56 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Apr 23 01:26:20 2006 @@ -408,7 +408,7 @@ SelectionDAGLowering(SelectionDAG &dag, TargetLowering &tli, FunctionLoweringInfo &funcinfo) : TLI(tli), DAG(dag), TD(DAG.getTarget().getTargetData()), - JT(0,0,0), FuncInfo(funcinfo) { + JT(0,0,0,0), FuncInfo(funcinfo) { } /// getRoot - Return the current virtual root of the Selection DAG. @@ -891,7 +891,7 @@ // FIXME: Make this work with 64 bit targets someday, possibly by always // doing differences there so that entries stay 32 bits. // FIXME: Make this work with PIC code - if (0 && TLI.isOperationLegal(ISD::BRIND, TLI.getPointerTy()) && + if (TLI.isOperationLegal(ISD::BRIND, TLI.getPointerTy()) && TLI.getPointerTy() == MVT::i32 && (Relocs == Reloc::Static || Relocs == Reloc::DynamicNoPIC) && Cases.size() > 3) { @@ -955,6 +955,7 @@ JT.Reg = JumpTableReg; JT.JTI = JTI; JT.MBB = JumpTableBB; + JT.Default = Default; JT.SuccMBBs = UniqueBBs; return; } @@ -3190,12 +3191,15 @@ return; } - // If we need to emit a jump table, + // If the JumpTable record is filled in, then we need to emit a jump table. + // Updating the PHI nodes is tricky in this case, since we need to determine + // whether the PHI is a successor of the range check MBB or the jump table MBB if (JT.Reg) { assert(SwitchCases.empty() && "Cannot have jump table and lowered switch"); SelectionDAG SDAG(TLI, MF, getAnalysisToUpdate<MachineDebugInfo>()); CurDAG = &SDAG; SelectionDAGLowering SDL(SDAG, TLI, FuncInfo); + MachineBasicBlock *RangeBB = BB; // Set the current basic block to the mbb we wish to insert the code into BB = JT.MBB; SDL.setCurrentBasicBlock(BB); @@ -3209,9 +3213,10 @@ MachineBasicBlock *PHIBB = PHI->getParent(); assert(PHI->getOpcode() == TargetInstrInfo::PHI && "This is not a machine PHI node that we are updating!"); - if (JT.SuccMBBs.find(PHIBB) != JT.SuccMBBs.end()) { + if (PHIBB == JT.Default || JT.SuccMBBs.find(PHIBB) != JT.SuccMBBs.end()) { + PHIBB = (PHIBB == JT.Default) ? RangeBB : BB; PHI->addRegOperand(PHINodesToUpdate[pi].second); - PHI->addMachineBasicBlockOperand(BB); + PHI->addMachineBasicBlockOperand(PHIBB); } } return; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits