summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-27 05:50:18 +0000
committerChris Lattner <sabre@nondot.org>2006-03-27 05:50:18 +0000
commit42e0ba09aae1a9eb6e5f4077dcc25f4fc4cb12e2 (patch)
tree732a62f74c661259e8afbce9c917e4abf31c03d3 /llvm/lib
parent1738c293b54ba9072a9ffd263ef34b0f38912294 (diff)
downloadbcm5719-llvm-42e0ba09aae1a9eb6e5f4077dcc25f4fc4cb12e2.tar.gz
bcm5719-llvm-42e0ba09aae1a9eb6e5f4077dcc25f4fc4cb12e2.zip
teach the inliner to work with packed constants
llvm-svn: 27161
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/ValueMapper.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index 134a0a2019b..6db9ed55de2 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -92,6 +92,25 @@ Value *llvm::MapValue(const Value *V, std::map<const Value*, Value*> &VM) {
return VMSlot = ConstantExpr::get(CE->getOpcode(), MV1, MV2);
}
+ } else if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C)) {
+ for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) {
+ Value *MV = MapValue(CP->getOperand(i), VM);
+ if (MV != CP->getOperand(i)) {
+ // This packed value must contain a reference to a global, make a new
+ // packed constant and return it.
+ //
+ std::vector<Constant*> Values;
+ Values.reserve(CP->getNumOperands());
+ for (unsigned j = 0; j != i; ++j)
+ Values.push_back(CP->getOperand(j));
+ Values.push_back(cast<Constant>(MV));
+ for (++i; i != e; ++i)
+ Values.push_back(cast<Constant>(MapValue(CP->getOperand(i), VM)));
+ return VMSlot = ConstantPacked::get(Values);
+ }
+ }
+ return VMSlot = C;
+
} else {
assert(0 && "Unknown type of constant!");
}
OpenPOWER on IntegriCloud