aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/CodeGen/FastISel.h5
-rw-r--r--lib/CodeGen/SelectionDAG/FastISel.cpp11
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp4
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h1
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp38
5 files changed, 15 insertions, 44 deletions
diff --git a/include/llvm/CodeGen/FastISel.h b/include/llvm/CodeGen/FastISel.h
index 2e9a3dd59a..202efe2f9f 100644
--- a/include/llvm/CodeGen/FastISel.h
+++ b/include/llvm/CodeGen/FastISel.h
@@ -75,11 +75,6 @@ public:
MBB = mbb;
}
- /// setCurDebugLoc - Set the current debug location information, which is used
- /// when creating a machine instruction.
- ///
- void setCurDebugLoc(DebugLoc dl) { DL = dl; }
-
/// getCurDebugLoc() - Return current debug location information.
DebugLoc getCurDebugLoc() const { return DL; }
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp
index c791c45c0e..cd72fe7003 100644
--- a/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -552,14 +552,21 @@ bool FastISel::SelectBitCast(const User *I) {
bool
FastISel::SelectInstruction(const Instruction *I) {
+ DL = I->getDebugLoc();
+
// First, try doing target-independent selection.
- if (SelectOperator(I, I->getOpcode()))
+ if (SelectOperator(I, I->getOpcode())) {
+ DL = DebugLoc();
return true;
+ }
// Next, try calling the target to attempt to handle the instruction.
- if (TargetSelectInstruction(I))
+ if (TargetSelectInstruction(I)) {
+ DL = DebugLoc();
return true;
+ }
+ DL = DebugLoc();
return false;
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index e21bc796b9..470689bd06 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -614,7 +614,11 @@ void SelectionDAGBuilder::AssignOrderingToNode(const SDNode *Node) {
}
void SelectionDAGBuilder::visit(const Instruction &I) {
+ CurDebugLoc = I.getDebugLoc();
+
visit(I.getOpcode(), I);
+
+ CurDebugLoc = DebugLoc();
}
void SelectionDAGBuilder::visit(unsigned Opcode, const User &I) {
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
index 883b9b1b18..1f9e43ff33 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
@@ -333,7 +333,6 @@ public:
SDValue getControlRoot();
DebugLoc getCurDebugLoc() const { return CurDebugLoc; }
- void setCurDebugLoc(DebugLoc dl) { CurDebugLoc = dl; }
unsigned getSDNodeOrder() const { return SDNodeOrder; }
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index d47c76bbbf..796b14d070 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -224,26 +224,6 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
return true;
}
-/// SetDebugLoc - Update MF's and SDB's DebugLocs if debug information is
-/// attached with this instruction.
-static void SetDebugLoc(const Instruction *I, SelectionDAGBuilder *SDB,
- FastISel *FastIS, MachineFunction *MF) {
- DebugLoc DL = I->getDebugLoc();
- if (DL.isUnknown()) return;
-
- SDB->setCurDebugLoc(DL);
-
- if (FastIS)
- FastIS->setCurDebugLoc(DL);
-}
-
-/// ResetDebugLoc - Set MF's and SDB's DebugLocs to Unknown.
-static void ResetDebugLoc(SelectionDAGBuilder *SDB, FastISel *FastIS) {
- SDB->setCurDebugLoc(DebugLoc());
- if (FastIS)
- FastIS->setCurDebugLoc(DebugLoc());
-}
-
MachineBasicBlock *
SelectionDAGISel::SelectBasicBlock(MachineBasicBlock *BB,
const BasicBlock *LLVMBB,
@@ -255,11 +235,8 @@ SelectionDAGISel::SelectBasicBlock(MachineBasicBlock *BB,
// are handled below.
for (BasicBlock::const_iterator I = Begin;
I != End && !SDB->HasTailCall && !isa<TerminatorInst>(I);
- ++I) {
- SetDebugLoc(I, SDB, 0, MF);
+ ++I)
SDB->visit(*I);
- ResetDebugLoc(SDB, 0);
- }
if (!SDB->HasTailCall) {
// Ensure that all instructions which are used outside of their defining
@@ -273,9 +250,7 @@ SelectionDAGISel::SelectBasicBlock(MachineBasicBlock *BB,
HandlePHINodesInSuccessorBlocks(LLVMBB);
// Lower the terminator after the copies are emitted.
- SetDebugLoc(LLVMBB->getTerminator(), SDB, 0, MF);
SDB->visit(*LLVMBB->getTerminator());
- ResetDebugLoc(SDB, 0);
}
}
@@ -800,7 +775,6 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
if (isa<TerminatorInst>(BI))
if (!HandlePHINodesInSuccessorBlocksFast(LLVMBB, FastIS)) {
++NumFastIselFailures;
- ResetDebugLoc(SDB, FastIS);
if (EnableFastISelVerbose || EnableFastISelAbort) {
dbgs() << "FastISel miss: ";
BI->dump();
@@ -810,17 +784,9 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
break;
}
- SetDebugLoc(BI, SDB, FastIS, MF);
-
// Try to select the instruction with FastISel.
- if (FastIS->SelectInstruction(BI)) {
- ResetDebugLoc(SDB, FastIS);
+ if (FastIS->SelectInstruction(BI))
continue;
- }
-
- // Clear out the debug location so that it doesn't carry over to
- // unrelated instructions.
- ResetDebugLoc(SDB, FastIS);
// Then handle certain instructions as single-LLVM-Instruction blocks.
if (isa<CallInst>(BI)) {