[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Reid Spencer reid at x10sys.com
Thu Nov 30 15:13:50 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.555 -> 1.556
---
Log message:

Remove 4 FIXMEs to hack around cast-to-bool problems which no longer exist.


---
Diffs of the changes:  (+3 -46)

 InstructionCombining.cpp |   49 ++---------------------------------------------
 1 files changed, 3 insertions(+), 46 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.555 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.556
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.555	Wed Nov 29 01:18:39 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Nov 30 17:13:36 2006
@@ -5778,13 +5778,6 @@
   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;
@@ -6092,35 +6085,11 @@
 }
 
 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) {
@@ -6132,19 +6101,7 @@
 }
 
 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) {






More information about the llvm-commits mailing list