From 447f95202a1447ead4602f74405bc1bab6aa6d87 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 17 Aug 2011 18:10:43 +0000 Subject: Silly mistake from r137777; restore significant isStructTy() checks. While here, be a bit more defensive with unknown instructions. Fixes PR10687. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137836 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/SCCP.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'lib/Transforms/Scalar/SCCP.cpp') diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 48c8d90c62..cfe750c5fa 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -1436,7 +1436,7 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) { // Only a few things that can be structs matter for undef. Just send // all their results to overdefined. We could be more precise than this // but it isn't worth bothering. - if (isa(I) || isa(I)) { + if (!isa(I) && !isa(I)) { for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { LatticeVal &LV = getStructValueState(I, i); if (LV.isUndefined()) @@ -1449,16 +1449,31 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) { LatticeVal &LV = getValueState(I); if (!LV.isUndefined()) continue; + // extractvalue is safe; check here because the argument is a struct. + if (isa(I)) + continue; + + // Compute the operand LatticeVals, for convenience below. + // Anything taking a struct is conservatively assumed to require + // overdefined markings. + if (I->getOperand(0)->getType()->isStructTy()) { + markOverdefined(I); + return true; + } LatticeVal Op0LV = getValueState(I->getOperand(0)); LatticeVal Op1LV; - if (I->getNumOperands() == 2) + if (I->getNumOperands() == 2) { + if (I->getOperand(1)->getType()->isStructTy()) { + markOverdefined(I); + return true; + } + Op1LV = getValueState(I->getOperand(1)); + } // If this is an instructions whose result is defined even if the input is // not fully defined, propagate the information. Type *ITy = I->getType(); switch (I->getOpcode()) { - case Instruction::ExtractValue: - break; // Extract of undef -> undef case Instruction::Add: case Instruction::Sub: case Instruction::Trunc: -- cgit v1.2.3