[llvm-commits] [llvm] r47314 - /llvm/trunk/lib/VMCore/ConstantFold.cpp

Chris Lattner sabre at nondot.org
Mon Feb 18 22:22:12 PST 2008


Author: lattner
Date: Tue Feb 19 00:22:12 2008
New Revision: 47314

URL: http://llvm.org/viewvc/llvm-project?rev=47314&view=rev
Log:
Fix some minor issues folding undef, PR2052

Modified:
    llvm/trunk/lib/VMCore/ConstantFold.cpp

Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=47314&r1=47313&r2=47314&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Feb 19 00:22:12 2008
@@ -175,7 +175,9 @@
   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);
   }





More information about the llvm-commits mailing list