[llvm-commits] CVS: llvm/lib/Transforms/Utils/ValueMapper.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 5 14:45:02 PST 2003


Changes in directory llvm/lib/Transforms/Utils:

ValueMapper.cpp updated: 1.6 -> 1.7

---
Log message:

Yet more fixes for constant expr shifts


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

Index: llvm/lib/Transforms/Utils/ValueMapper.cpp
diff -u llvm/lib/Transforms/Utils/ValueMapper.cpp:1.6 llvm/lib/Transforms/Utils/ValueMapper.cpp:1.7
--- llvm/lib/Transforms/Utils/ValueMapper.cpp:1.6	Mon Oct 20 14:43:20 2003
+++ llvm/lib/Transforms/Utils/ValueMapper.cpp	Wed Nov  5 14:43:58 2003
@@ -82,6 +82,12 @@
         for (unsigned i = 1, e = CE->getNumOperands(); i != e; ++i)
           Idx.push_back(cast<Constant>(MapValue(CE->getOperand(i), VM)));
         return VMSlot = ConstantExpr::getGetElementPtr(MV, Idx);
+      } else if (CE->getOpcode() == Instruction::Shl ||
+                 CE->getOpcode() == Instruction::Shr) {
+        assert(CE->getNumOperands() == 2 && "Must be a shift!");
+        Constant *MV1 = cast<Constant>(MapValue(CE->getOperand(0), VM));
+        Constant *MV2 = cast<Constant>(MapValue(CE->getOperand(1), VM));
+        return VMSlot = ConstantExpr::getShift(CE->getOpcode(), MV1, MV2);
       } else {
         assert(CE->getNumOperands() == 2 && "Must be binary operator?");
         Constant *MV1 = cast<Constant>(MapValue(CE->getOperand(0), VM));





More information about the llvm-commits mailing list