summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/ValueMapper.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-05 20:43:58 +0000
committerChris Lattner <sabre@nondot.org>2003-11-05 20:43:58 +0000
commite7a6663eb155eb8eb5de24cf22f632790485e5f9 (patch)
tree4bd603090cac604af1864ea22a05662c9043ef51 /lib/Transforms/Utils/ValueMapper.cpp
parentd981f8af79be9ea647d593531091740a3a27a85f (diff)
downloadllvm-e7a6663eb155eb8eb5de24cf22f632790485e5f9.tar.gz
llvm-e7a6663eb155eb8eb5de24cf22f632790485e5f9.tar.bz2
llvm-e7a6663eb155eb8eb5de24cf22f632790485e5f9.tar.xz
Yet more fixes for constant expr shifts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r--lib/Transforms/Utils/ValueMapper.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp
index adf2c5548e..6590498bbc 100644
--- a/lib/Transforms/Utils/ValueMapper.cpp
+++ b/lib/Transforms/Utils/ValueMapper.cpp
@@ -82,6 +82,12 @@ Value *MapValue(const Value *V, std::map<const Value*, Value*> &VM) {
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));