fix a crash in SCCP handling extractvalue of an array, pointed out and

tracked down by Stephan Reiter!

llvm-svn: 86726
This commit is contained in:
Chris Lattner 2009-11-10 22:02:09 +00:00
parent b92c9347ba
commit a163be92fc
2 changed files with 13 additions and 3 deletions

View File

@ -795,9 +795,14 @@ void SCCPSolver::visitExtractValueInst(ExtractValueInst &EVI) {
return markOverdefined(&EVI);
Value *AggVal = EVI.getAggregateOperand();
unsigned i = *EVI.idx_begin();
LatticeVal EltVal = getStructValueState(AggVal, i);
mergeInValue(getValueState(&EVI), &EVI, EltVal);
if (isa<StructType>(AggVal->getType())) {
unsigned i = *EVI.idx_begin();
LatticeVal EltVal = getStructValueState(AggVal, i);
mergeInValue(getValueState(&EVI), &EVI, EltVal);
} else {
// Otherwise, must be extracting from an array.
return markOverdefined(&EVI);
}
}
void SCCPSolver::visitInsertValueInst(InsertValueInst &IVI) {

View File

@ -22,3 +22,8 @@ bb34:
return:
ret void
}
define i32 @test2([4 x i32] %A) {
%B = extractvalue [4 x i32] %A, 1
ret i32 %B
}