mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
When truncating to bool, it is necessary to & with 1 for all casts that
can result in a bool. Previously PtrToInt, FPToUI and FPToSI were missing this operation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31938 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -626,8 +626,11 @@ void CWriter::printConstant(Constant *CPV) {
|
|||||||
Out << "0-";
|
Out << "0-";
|
||||||
}
|
}
|
||||||
printConstant(CE->getOperand(0));
|
printConstant(CE->getOperand(0));
|
||||||
if (CE->getOpcode() == Instruction::Trunc &&
|
if (CE->getType() == Type::BoolTy &&
|
||||||
CE->getType() == Type::BoolTy) {
|
(CE->getOpcode() == Instruction::Trunc ||
|
||||||
|
CE->getOpcode() == Instruction::FPToUI ||
|
||||||
|
CE->getOpcode() == Instruction::FPToSI ||
|
||||||
|
CE->getOpcode() == Instruction::PtrToInt)) {
|
||||||
// Make sure we really truncate to bool here by anding with 1
|
// Make sure we really truncate to bool here by anding with 1
|
||||||
Out << "&1u";
|
Out << "&1u";
|
||||||
}
|
}
|
||||||
@ -1960,7 +1963,11 @@ void CWriter::visitCastInst(CastInst &I) {
|
|||||||
Out << "0-";
|
Out << "0-";
|
||||||
}
|
}
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
if (I.getOpcode() == Instruction::Trunc && DstTy == Type::BoolTy) {
|
if (DstTy == Type::BoolTy &&
|
||||||
|
(I.getOpcode() == Instruction::Trunc ||
|
||||||
|
I.getOpcode() == Instruction::FPToUI ||
|
||||||
|
I.getOpcode() == Instruction::FPToSI ||
|
||||||
|
I.getOpcode() == Instruction::PtrToInt)) {
|
||||||
// Make sure we really get a trunc to bool by anding the operand with 1
|
// Make sure we really get a trunc to bool by anding the operand with 1
|
||||||
Out << "&1u";
|
Out << "&1u";
|
||||||
}
|
}
|
||||||
|
@ -626,8 +626,11 @@ void CWriter::printConstant(Constant *CPV) {
|
|||||||
Out << "0-";
|
Out << "0-";
|
||||||
}
|
}
|
||||||
printConstant(CE->getOperand(0));
|
printConstant(CE->getOperand(0));
|
||||||
if (CE->getOpcode() == Instruction::Trunc &&
|
if (CE->getType() == Type::BoolTy &&
|
||||||
CE->getType() == Type::BoolTy) {
|
(CE->getOpcode() == Instruction::Trunc ||
|
||||||
|
CE->getOpcode() == Instruction::FPToUI ||
|
||||||
|
CE->getOpcode() == Instruction::FPToSI ||
|
||||||
|
CE->getOpcode() == Instruction::PtrToInt)) {
|
||||||
// Make sure we really truncate to bool here by anding with 1
|
// Make sure we really truncate to bool here by anding with 1
|
||||||
Out << "&1u";
|
Out << "&1u";
|
||||||
}
|
}
|
||||||
@ -1960,7 +1963,11 @@ void CWriter::visitCastInst(CastInst &I) {
|
|||||||
Out << "0-";
|
Out << "0-";
|
||||||
}
|
}
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
if (I.getOpcode() == Instruction::Trunc && DstTy == Type::BoolTy) {
|
if (DstTy == Type::BoolTy &&
|
||||||
|
(I.getOpcode() == Instruction::Trunc ||
|
||||||
|
I.getOpcode() == Instruction::FPToUI ||
|
||||||
|
I.getOpcode() == Instruction::FPToSI ||
|
||||||
|
I.getOpcode() == Instruction::PtrToInt)) {
|
||||||
// Make sure we really get a trunc to bool by anding the operand with 1
|
// Make sure we really get a trunc to bool by anding the operand with 1
|
||||||
Out << "&1u";
|
Out << "&1u";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user