[llvm-commits] [llvm] r102128 - in /llvm/trunk/lib/CodeGen/SelectionDAG: SelectionDAGBuilder.cpp SelectionDAGBuilder.h SelectionDAGISel.cpp
Dan Gohman
gohman at apple.com
Thu Apr 22 13:55:54 PDT 2010
Author: djg
Date: Thu Apr 22 15:55:53 2010
New Revision: 102128
URL: http://llvm.org/viewvc/llvm-project?rev=102128&view=rev
Log:
Sink SelectionDAGBuilder's HandlePHINodesInSuccessorBlocks down
into SelectionDAGBuilder itself.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=102128&r1=102127&r2=102128&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Apr 22 15:55:53 2010
@@ -615,6 +615,10 @@
}
void SelectionDAGBuilder::visit(const Instruction &I) {
+ // Set up outgoing PHI node register values before emitting the terminator.
+ if (isa<TerminatorInst>(&I))
+ HandlePHINodesInSuccessorBlocks(I.getParent());
+
CurDebugLoc = I.getDebugLoc();
visit(I.getOpcode(), I);
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h?rev=102128&r1=102127&r2=102128&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h Thu Apr 22 15:55:53 2010
@@ -369,8 +369,6 @@
void LowerCallTo(ImmutableCallSite CS, SDValue Callee, bool IsTailCall,
MachineBasicBlock *LandingPad = NULL);
- void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
-
private:
// Terminator instructions.
void visitRet(const ReturnInst &I);
@@ -495,6 +493,8 @@
const char *implVisitBinaryAtomic(const CallInst& I, ISD::NodeType Op);
const char *implVisitAluOverflow(const CallInst &I, ISD::NodeType Op);
+
+ void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
};
} // end namespace llvm
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=102128&r1=102127&r2=102128&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Apr 22 15:55:53 2010
@@ -233,21 +233,9 @@
// Lower all of the non-terminator instructions. If a call is emitted
// as a tail call, cease emitting nodes for this block. Terminators
// are handled below.
- for (BasicBlock::const_iterator I = Begin;
- I != End && !SDB->HasTailCall && !isa<TerminatorInst>(I);
- ++I)
+ for (BasicBlock::const_iterator I = Begin; I != End && !SDB->HasTailCall; ++I)
SDB->visit(*I);
- if (!SDB->HasTailCall) {
- // Handle PHI nodes in successor blocks.
- if (End == LLVMBB->end()) {
- SDB->HandlePHINodesInSuccessorBlocks(LLVMBB);
-
- // Lower the terminator after the copies are emitted.
- SDB->visit(*LLVMBB->getTerminator());
- }
- }
-
// Make sure the root of the DAG is up-to-date.
CurDAG->setRoot(SDB->getControlRoot());
More information about the llvm-commits
mailing list