diff options
author | Chris Lattner <sabre@nondot.org> | 2008-02-19 06:22:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-02-19 06:22:12 +0000 |
commit | 189a13471ed5677c7eedd182e78881fc78830ff8 (patch) | |
tree | f6512529f2485853fe0dd014dd0a14692262906c /lib/VMCore/ConstantFold.cpp | |
parent | 653ef3c739d1a65b09e16a70bb2b9c79f9842d9d (diff) | |
download | external_llvm-189a13471ed5677c7eedd182e78881fc78830ff8.zip external_llvm-189a13471ed5677c7eedd182e78881fc78830ff8.tar.gz external_llvm-189a13471ed5677c7eedd182e78881fc78830ff8.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.cpp | 4 |
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); } |