From 950fe784be6a2ad13bd47aef034ed025cccb97e7 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 20 Apr 2010 15:03:56 +0000 Subject: [PATCH] Sink the CopyToExportRegsIfNeeded calls out of SelectionDAGISel into SelectionDAGBuilder. This avoids a separate pass over the instructions, and has the side effect of providing debug location information to the copy. llvm-svn: 101906 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 3 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 054174f037e9..ce5a65b7a179 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -618,6 +618,9 @@ void SelectionDAGBuilder::visit(const Instruction &I) { visit(I.getOpcode(), I); + if (!isa(&I) && !HasTailCall) + CopyToExportRegsIfNeeded(&I); + CurDebugLoc = DebugLoc(); } diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 2a27d1b59a2c..7c2c5282f297 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -239,12 +239,6 @@ SelectionDAGISel::SelectBasicBlock(MachineBasicBlock *BB, SDB->visit(*I); if (!SDB->HasTailCall) { - // Ensure that all instructions which are used outside of their defining - // blocks are available as virtual registers. Invoke is handled elsewhere. - for (BasicBlock::const_iterator I = Begin; I != End; ++I) - if (!isa(I) && !isa(I)) - SDB->CopyToExportRegsIfNeeded(I); - // Handle PHI nodes in successor blocks. if (End == LLVMBB->end()) { HandlePHINodesInSuccessorBlocks(LLVMBB);