From 189a13471ed5677c7eedd182e78881fc78830ff8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 19 Feb 2008 06:22:12 +0000 Subject: Fix some minor issues folding undef, PR2052 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47314 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/ConstantFold.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/VMCore/ConstantFold.cpp') diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 4983a03..06dc9dc 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -175,7 +175,9 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V, if (isa(V)) { // zext(undef) = 0, because the top bits will be zero. // sext(undef) = 0, because the top bits will all be the same. - if (opc == Instruction::ZExt || opc == Instruction::SExt) + // [us]itofp(undef) = 0, because the result value is bounded. + if (opc == Instruction::ZExt || opc == Instruction::SExt || + opc == Instruction::UIToFP || opc == Instruction::SIToFP) return Constant::getNullValue(DestTy); return UndefValue::get(DestTy); } -- cgit v1.1