aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-11-28 07:23:01 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-11-28 07:23:01 +0000
commit5d4dbd1f605bf4517a7e51a30eed714ef2f6fa7a (patch)
tree4124f027499b24e2bf687cb53b0dabcd5316f4c9 /lib/Transforms
parent5e1452c856a8bcf39ab7a67a5af946c8162f942d (diff)
Remove 4 FIXME's from the CAST patch now that the back end is correctly
producing code for "trunc to bool". This passes all tests on Linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31963 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp49
1 files changed, 3 insertions, 46 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 223624049e..532f112ebc 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -5739,13 +5739,6 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) {
unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits();
unsigned DestBitSize = DestTy->getPrimitiveSizeInBits();
- // FIXME. We currently implement cast-to-bool as a setne %X, 0. This is
- // because codegen cannot accurately perform a truncate to bool operation.
- // Something goes wrong in promotion to a larger type. When CodeGen can
- // handle a proper truncation to bool, this should be removed.
- if (DestTy == Type::BoolTy)
- return BinaryOperator::createSetNE(Src, Constant::getNullValue(SrcTy));
-
// See if we can simplify any instructions used by the LHS whose sole
// purpose is to compute bits we don't care about.
uint64_t KnownZero = 0, KnownOne = 0;
@@ -6021,35 +6014,11 @@ Instruction *InstCombiner::visitFPExt(CastInst &CI) {
}
Instruction *InstCombiner::visitFPToUI(CastInst &CI) {
- if (Instruction *I = commonCastTransforms(CI))
- return I;
-
- // FIXME. We currently implement cast-to-bool as a setne %X, 0. This is
- // because codegen cannot accurately perform a truncate to bool operation.
- // Something goes wrong in promotion to a larger type. When CodeGen can
- // handle a proper truncation to bool, this should be removed.
- Value *Src = CI.getOperand(0);
- const Type *SrcTy = Src->getType();
- const Type *DestTy = CI.getType();
- if (DestTy == Type::BoolTy)
- return BinaryOperator::createSetNE(Src, Constant::getNullValue(SrcTy));
- return 0;
+ return commonCastTransforms(CI);
}
Instruction *InstCombiner::visitFPToSI(CastInst &CI) {
- if (Instruction *I = commonCastTransforms(CI))
- return I;
-
- // FIXME. We currently implement cast-to-bool as a setne %X, 0. This is
- // because codegen cannot accurately perform a truncate to bool operation.
- // Something goes wrong in promotion to a larger type. When CodeGen can
- // handle a proper truncation to bool, this should be removed.
- Value *Src = CI.getOperand(0);
- const Type *SrcTy = Src->getType();
- const Type *DestTy = CI.getType();
- if (DestTy == Type::BoolTy)
- return BinaryOperator::createSetNE(Src, Constant::getNullValue(SrcTy));
- return 0;
+ return commonCastTransforms(CI);
}
Instruction *InstCombiner::visitUIToFP(CastInst &CI) {
@@ -6061,19 +6030,7 @@ Instruction *InstCombiner::visitSIToFP(CastInst &CI) {
}
Instruction *InstCombiner::visitPtrToInt(CastInst &CI) {
- if (Instruction *I = commonCastTransforms(CI))
- return I;
-
- // FIXME. We currently implement cast-to-bool as a setne %X, 0. This is
- // because codegen cannot accurately perform a truncate to bool operation.
- // Something goes wrong in promotion to a larger type. When CodeGen can
- // handle a proper truncation to bool, this should be removed.
- Value *Src = CI.getOperand(0);
- const Type *SrcTy = Src->getType();
- const Type *DestTy = CI.getType();
- if (DestTy == Type::BoolTy)
- return BinaryOperator::createSetNE(Src, Constant::getNullValue(SrcTy));
- return 0;
+ return commonCastTransforms(CI);
}
Instruction *InstCombiner::visitIntToPtr(CastInst &CI) {