[llvm-commits] CVS: llvm/lib/Transforms/Utils/ValueMapper.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Mar 26 21:50:31 PST 2006
Changes in directory llvm/lib/Transforms/Utils:
ValueMapper.cpp updated: 1.21 -> 1.22
---
Log message:
teach the inliner to work with packed constants
---
Diffs of the changes: (+19 -0)
ValueMapper.cpp | 19 +++++++++++++++++++
1 files changed, 19 insertions(+)
Index: llvm/lib/Transforms/Utils/ValueMapper.cpp
diff -u llvm/lib/Transforms/Utils/ValueMapper.cpp:1.21 llvm/lib/Transforms/Utils/ValueMapper.cpp:1.22
--- llvm/lib/Transforms/Utils/ValueMapper.cpp:1.21 Wed Jan 25 19:55:22 2006
+++ llvm/lib/Transforms/Utils/ValueMapper.cpp Sun Mar 26 23:50:18 2006
@@ -92,6 +92,25 @@
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!");
}
More information about the llvm-commits
mailing list