summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commitb4c6cc95871e4daf1b6531981e803dbde0d8840e (patch)
tree5e329b77f61e19b11180a7ad2043d84bc5249a19 /llvm/lib
parent0fe6bce9ce6412688971c55b61bdd1466f714531 (diff)
downloadbcm5719-llvm-b4c6cc95871e4daf1b6531981e803dbde0d8840e.tar.gz
bcm5719-llvm-b4c6cc95871e4daf1b6531981e803dbde0d8840e.zip
Fix some minor issues folding undef, PR2052
llvm-svn: 47314
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/ConstantFold.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/ConstantFold.cpp b/llvm/lib/VMCore/ConstantFold.cpp
index 4983a036be2..06dc9dc89f7 100644
--- a/llvm/lib/VMCore/ConstantFold.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud