summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-11 22:03:46 +0000
committerChris Lattner <sabre@nondot.org>2005-01-11 22:03:46 +0000
commit613f79fcbb4ccfae89b4272102f7d9ee30a3139b (patch)
tree5dc2e625f73d2c6d521f9c646662a3bb041260cb /llvm/lib
parent62b22420be5a0ee9e1df4d5b0ed1c8e9910e7731 (diff)
downloadbcm5719-llvm-613f79fcbb4ccfae89b4272102f7d9ee30a3139b.tar.gz
bcm5719-llvm-613f79fcbb4ccfae89b4272102f7d9ee30a3139b.zip
add an assertion, avoid creating copyfromreg/copytoreg pairs that are the
same for PHI nodes. llvm-svn: 19484
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 916943f30b1..9ccf87cfd84 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -762,7 +762,10 @@ bool SelectionDAGISel::runOnFunction(Function &Fn) {
void SelectionDAGISel::CopyValueToVirtualRegister(SelectionDAGLowering &SDL,
Value *V, unsigned Reg) {
SelectionDAG &DAG = SDL.DAG;
- DAG.setRoot(DAG.getCopyToReg(DAG.getRoot(), SDL.getValue(V), Reg));
+ SDOperand Op = SDL.getValue(V);
+ if (CopyRegSDNode *CR = dyn_cast<CopyRegSDNode>(Op))
+ assert(CR->getReg() != Reg && "Copy from a reg to the same reg!");
+ DAG.setRoot(DAG.getCopyToReg(DAG.getRoot(), Op, Reg));
}
void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
@@ -798,7 +801,7 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
// Ensure that all instructions which are used outside of their defining
// blocks are available as virtual registers.
for (BasicBlock::iterator I = LLVMBB->begin(), E = LLVMBB->end(); I != E;++I)
- if (!I->use_empty()) {
+ if (!I->use_empty() && !isa<PHINode>(I)) {
std::map<const Value*, unsigned>::iterator VMI =FuncInfo.ValueMap.find(I);
if (VMI != FuncInfo.ValueMap.end())
CopyValueToVirtualRegister(SDL, I, VMI->second);
OpenPOWER on IntegriCloud