mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
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
This commit is contained in:
parent
358499ea3b
commit
447f95202a
@ -1436,7 +1436,7 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
|
|||||||
// Only a few things that can be structs matter for undef. Just send
|
// 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
|
// all their results to overdefined. We could be more precise than this
|
||||||
// but it isn't worth bothering.
|
// but it isn't worth bothering.
|
||||||
if (isa<CallInst>(I) || isa<SelectInst>(I)) {
|
if (!isa<ExtractValueInst>(I) && !isa<InsertValueInst>(I)) {
|
||||||
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
|
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
|
||||||
LatticeVal &LV = getStructValueState(I, i);
|
LatticeVal &LV = getStructValueState(I, i);
|
||||||
if (LV.isUndefined())
|
if (LV.isUndefined())
|
||||||
@ -1449,16 +1449,31 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
|
|||||||
LatticeVal &LV = getValueState(I);
|
LatticeVal &LV = getValueState(I);
|
||||||
if (!LV.isUndefined()) continue;
|
if (!LV.isUndefined()) continue;
|
||||||
|
|
||||||
|
// extractvalue is safe; check here because the argument is a struct.
|
||||||
|
if (isa<ExtractValueInst>(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 Op0LV = getValueState(I->getOperand(0));
|
||||||
LatticeVal Op1LV;
|
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));
|
Op1LV = getValueState(I->getOperand(1));
|
||||||
|
}
|
||||||
// If this is an instructions whose result is defined even if the input is
|
// If this is an instructions whose result is defined even if the input is
|
||||||
// not fully defined, propagate the information.
|
// not fully defined, propagate the information.
|
||||||
Type *ITy = I->getType();
|
Type *ITy = I->getType();
|
||||||
switch (I->getOpcode()) {
|
switch (I->getOpcode()) {
|
||||||
case Instruction::ExtractValue:
|
|
||||||
break; // Extract of undef -> undef
|
|
||||||
case Instruction::Add:
|
case Instruction::Add:
|
||||||
case Instruction::Sub:
|
case Instruction::Sub:
|
||||||
case Instruction::Trunc:
|
case Instruction::Trunc:
|
||||||
|
@ -161,3 +161,12 @@ define i1 @test9() {
|
|||||||
; CHECK: @test9
|
; CHECK: @test9
|
||||||
; CHECK: icmp ugt
|
; CHECK: icmp ugt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; Make sure we handle extractvalue
|
||||||
|
define i64 @test10() {
|
||||||
|
entry:
|
||||||
|
%e = extractvalue { i64, i64 } undef, 1
|
||||||
|
ret i64 %e
|
||||||
|
; CHECK: @test10
|
||||||
|
; CHECK: ret i64 undef
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user