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

tracked down by Stephan Reiter!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86726 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-11-10 22:02:09 +00:00
parent f235f13931
commit 103f2434b8
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();
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
}