aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/ConstantFold.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-02-19 06:22:12 +0000
committerChris Lattner <sabre@nondot.org>2008-02-19 06:22:12 +0000
commit46acf85b97534fcf9997286da87c38210ce937ec (patch)
treef6512529f2485853fe0dd014dd0a14692262906c /lib/VMCore/ConstantFold.cpp
parent50b2ca4c73c614574a847c43ad9b87301367c59b (diff)
downloadexternal_llvm-46acf85b97534fcf9997286da87c38210ce937ec.zip
external_llvm-46acf85b97534fcf9997286da87c38210ce937ec.tar.gz
external_llvm-46acf85b97534fcf9997286da87c38210ce937ec.tar.bz2
Fix some minor issues folding undef, PR2052
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp4
1 files changed, 3 insertions, 1 deletions
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<UndefValue>(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);
}