[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp

Chris Lattner sabre at nondot.org
Fri Dec 1 11:51:09 PST 2006



Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.104 -> 1.105
---
Log message:

These should be rewritten to fold without using the 'Rules' mechanism, but
until this happens at least make sext from bool and sitofp from bool do the
right thing.


---
Diffs of the changes:  (+3 -0)

 ConstantFolding.cpp |    3 +++
 1 files changed, 3 insertions(+)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.104 llvm/lib/VMCore/ConstantFolding.cpp:1.105
--- llvm/lib/VMCore/ConstantFolding.cpp:1.104	Fri Dec  1 13:22:41 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp	Fri Dec  1 13:50:54 2006
@@ -890,6 +890,9 @@
     if (isa<ConstantInt>(V))
       V = ConstantInt::get(SrcTy->getSignedVersion(), 
                            cast<ConstantIntegral>(V)->getSExtValue());
+    else if (const ConstantBool *CB = dyn_cast<ConstantBool>(V))
+      V = ConstantInt::get(Type::SByteTy, CB->getValue() ? -1 : 0);
+      
     break;
   case Instruction::Trunc:
     // We just handle trunc directly here.  The code below doesn't work for






More information about the llvm-commits mailing list