1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Fix the conditions under which SCCP should examine insertvalue

instructions. Thanks to Matthijs Kooijman for pointing this out!

llvm-svn: 52542
This commit is contained in:
Dan Gohman 2008-06-20 16:39:44 +00:00
parent f62b13bc3d
commit 3968f90c4c

View File

@ -750,7 +750,7 @@ void SCCPSolver::visitInsertValueInst(InsertValueInst &IVI) {
Value *Val = IVI.getOperand(1);
// If the operand to the getresult is an undef, the result is undef.
if (isa<UndefValue>(Aggr))
if (isa<UndefValue>(Aggr) && isa<UndefValue>(Val))
return;
// Currently only handle single-index insertvalues.
@ -758,6 +758,23 @@ void SCCPSolver::visitInsertValueInst(InsertValueInst &IVI) {
markOverdefined(&IVI);
return;
}
// Currently only handle insertvalue instructions that are in a single-use
// chain that builds up a return value.
for (const InsertValueInst *TmpIVI = &IVI; ; ) {
if (!TmpIVI->hasOneUse()) {
markOverdefined(&IVI);
return;
}
const Value *V = *TmpIVI->use_begin();
if (isa<ReturnInst>(V))
break;
TmpIVI = dyn_cast<InsertValueInst>(V);
if (!TmpIVI) {
markOverdefined(&IVI);
return;
}
}
// See if we are tracking the result of the callee.
Function *F = IVI.getParent()->getParent();