summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/ValueMapper.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-13 02:43:19 +0000
committerChris Lattner <sabre@nondot.org>2004-08-13 02:43:19 +0000
commiteb6f18fe7c375ce5598c6ba6d5b9ae769fbf2610 (patch)
tree4848ec1c14afc7f108286e214cf1f19eb2399956 /lib/Transforms/Utils/ValueMapper.cpp
parent5a104b0ec5b392b5f2ba42a774adce4b8668af8a (diff)
downloadllvm-eb6f18fe7c375ce5598c6ba6d5b9ae769fbf2610.tar.gz
llvm-eb6f18fe7c375ce5598c6ba6d5b9ae769fbf2610.tar.bz2
llvm-eb6f18fe7c375ce5598c6ba6d5b9ae769fbf2610.tar.xz
Add value mapper support for select constant exprs. This should fix a bug
Nate ran into when bugpointing siod. This fix should go into LLVM 1.3 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15712 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r--lib/Transforms/Utils/ValueMapper.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp
index 72ce4ae81f..d7507f9f07 100644
--- a/lib/Transforms/Utils/ValueMapper.cpp
+++ b/lib/Transforms/Utils/ValueMapper.cpp
@@ -81,6 +81,11 @@ Value *llvm::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::Select) {
+ Constant *MV1 = cast<Constant>(MapValue(CE->getOperand(0), VM));
+ Constant *MV2 = cast<Constant>(MapValue(CE->getOperand(1), VM));
+ Constant *MV3 = cast<Constant>(MapValue(CE->getOperand(2), VM));
+ return VMSlot = ConstantExpr::getSelect(MV1, MV2, MV3);
} else {
assert(CE->getNumOperands() == 2 && "Must be binary operator?");
Constant *MV1 = cast<Constant>(MapValue(CE->getOperand(0), VM));