Fix a bug that caused a crash if a setcc had zero uses.
llvm-svn: 574
diff --git a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
index c73264c..fde7282 100644
--- a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
+++ b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
@@ -1688,7 +1688,7 @@
// to follow SSA def-use edges here, not BURG tree edges.
//
Instruction* result = subtreeRoot->getInstruction();
- Value* firstUse = (Value*) * result->use_begin();
+ Value* firstUse = result->use_empty() ? 0 : *result->use_begin();
bool discardResult =
(result->use_size() == 1
&& firstUse->isInstruction()