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

Chris Lattner lattner at cs.uiuc.edu
Thu Apr 24 21:53:00 PDT 2003


Changes in directory llvm/lib/VMCore:

ConstantHandling.cpp updated: 1.25 -> 1.26

---
Log message:

** CORRECTLY, conservatively handle constant expressions


---
Diffs of the changes:

Index: llvm/lib/VMCore/ConstantHandling.cpp
diff -u llvm/lib/VMCore/ConstantHandling.cpp:1.25 llvm/lib/VMCore/ConstantHandling.cpp:1.26
--- llvm/lib/VMCore/ConstantHandling.cpp:1.25	Thu Apr 17 14:24:18 2003
+++ llvm/lib/VMCore/ConstantHandling.cpp	Thu Apr 24 21:52:06 2003
@@ -47,7 +47,7 @@
 
   switch (I->getOpcode()) {
   case Instruction::Cast:
-    return ConstRules::get(*Op0)->castTo(Op0, I->getType());
+    return ConstRules::get(*Op0, *Op0)->castTo(Op0, I->getType());
   case Instruction::Add:     return *Op0 + *Op1;
   case Instruction::Sub:     return *Op0 - *Op1;
   case Instruction::Mul:     return *Op0 * *Op1;
@@ -107,7 +107,7 @@
       }
     }
 
-  return ConstRules::get(*V)->castTo(V, DestTy);
+  return ConstRules::get(*V, *V)->castTo(V, DestTy);
 }
 
 Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1,
@@ -554,4 +554,9 @@
   default:
     return new EmptyRules();
   }
+}
+
+ConstRules *ConstRules::getConstantExprRules() {
+  static EmptyRules CERules;
+  return &CERules;
 }





More information about the llvm-commits mailing list