From f53d83e5f075d5bfe38169a406617c06ef844bef Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Tue, 25 Sep 2007 23:07:07 +0000 Subject: Make APFloat->int conversions deterministic even in cases with undefined behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42328 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/ConstantFold.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/VMCore/ConstantFold.cpp') diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index d8b8566193..7154afb183 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -197,8 +197,6 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V, APFloat::opStatus status = V.convertToInteger(x, DestBitWidth, opc==Instruction::FPToSI, APFloat::rmTowardZero); - if (status!=APFloat::opOK && status!=APFloat::opInexact) - return 0; // give up APInt Val(DestBitWidth, 2, x); return ConstantInt::get(Val); } -- cgit v1.2.3