diff options
| author | Dan Gohman <gohman@apple.com> | 2010-04-16 17:15:02 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-04-16 17:15:02 +0000 |
| commit | 3a7ee8eead8ac7640f3ffd805c78bd275799de28 (patch) | |
| tree | 53e9bd86bc5f0b074129c862929ad61d8fd02ddc /llvm/lib/CodeGen | |
| parent | 5664b9f1a941db782d335d39816e1609784c4019 (diff) | |
| download | bcm5719-llvm-3a7ee8eead8ac7640f3ffd805c78bd275799de28.tar.gz bcm5719-llvm-3a7ee8eead8ac7640f3ffd805c78bd275799de28.zip | |
Avoid creating virtual registers for unused values.
llvm-svn: 101480
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 8 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 412de1c89bb..71da0ab3e56 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -918,10 +918,10 @@ void SelectionDAGBuilder::visitRet(const ReturnInst &I) { /// created for it, emit nodes to copy the value into the virtual /// registers. void SelectionDAGBuilder::CopyToExportRegsIfNeeded(const Value *V) { - if (!V->use_empty()) { - DenseMap<const Value *, unsigned>::iterator VMI = FuncInfo.ValueMap.find(V); - if (VMI != FuncInfo.ValueMap.end()) - CopyValueToVirtualRegister(V, VMI->second); + DenseMap<const Value *, unsigned>::iterator VMI = FuncInfo.ValueMap.find(V); + if (VMI != FuncInfo.ValueMap.end()) { + assert(!V->use_empty() && "Unused value assigned virtual registers!"); + CopyValueToVirtualRegister(V, VMI->second); } } diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 7436bbea723..9082fb6fbe9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -834,7 +834,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) { BI->dump(); } - if (!BI->getType()->isVoidTy()) { + if (!BI->getType()->isVoidTy() && !BI->use_empty()) { unsigned &R = FuncInfo->ValueMap[BI]; if (!R) R = FuncInfo->CreateRegForValue(BI); |

