Fix a bug that caused a crash if a setcc had zero uses.
authorChris Lattner <sabre@nondot.org>
Fri, 14 Sep 2001 18:29:28 +0000 (18:29 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 14 Sep 2001 18:29:28 +0000 (18:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@574 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SparcV9/SparcV9InstrSelection.cpp

index c73264c221071d0f58a94e59fa8f2b680bec68f8..fde7282e85ad386d8046c0a22fca5814875d1cc4 100644 (file)
@@ -1688,7 +1688,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
     // 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()