Changes in directory llvm/lib/Target/CBackend:
Writer.cpp updated: 1.283 -> 1.284 --- Log message: 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. --- Diffs of the changes: (+10 -3) Writer.cpp | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.283 llvm/lib/Target/CBackend/Writer.cpp:1.284 --- llvm/lib/Target/CBackend/Writer.cpp:1.283 Sun Nov 26 19:05:10 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Nov 27 12:51:06 2006 @@ -626,8 +626,11 @@ Out << "0-"; } printConstant(CE->getOperand(0)); - if (CE->getOpcode() == Instruction::Trunc && - CE->getType() == Type::BoolTy) { + if (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 Out << "&1u"; } @@ -1960,7 +1963,11 @@ Out << "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 Out << "&1u"; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits