forked from OSchip/llvm-project
Fix PR1679, by printing GEP indices as signed values instead of unsigned.
llvm-svn: 42239
This commit is contained in:
parent
322abe3573
commit
e48195e0f3
|
@ -1238,6 +1238,7 @@ void CWriter::writeOperandWithCast(Value* Operand, unsigned Opcode) {
|
||||||
shouldCast = true;
|
shouldCast = true;
|
||||||
castIsSigned = false;
|
castIsSigned = false;
|
||||||
break;
|
break;
|
||||||
|
case Instruction::GetElementPtr:
|
||||||
case Instruction::AShr:
|
case Instruction::AShr:
|
||||||
case Instruction::SDiv:
|
case Instruction::SDiv:
|
||||||
case Instruction::SRem: // Cast to signed first
|
case Instruction::SRem: // Cast to signed first
|
||||||
|
@ -2859,7 +2860,7 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
|
||||||
Out << ".field" << cast<ConstantInt>(I.getOperand())->getZExtValue();
|
Out << ".field" << cast<ConstantInt>(I.getOperand())->getZExtValue();
|
||||||
} else {
|
} else {
|
||||||
Out << '[';
|
Out << '[';
|
||||||
writeOperand(I.getOperand());
|
writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
|
||||||
Out << ']';
|
Out << ']';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue