summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-02-09 02:24:25 +0000
committerChris Lattner <sabre@nondot.org>2006-02-09 02:24:25 +0000
commitc1f523dedd7d90c02179184c55e837a9f5b8d73b (patch)
treec0dfdbca6f0b2a6ca04808fe394eabe366be5936 /include
parent948d9668a7bc96b435de7ebc1b4a28b70aeb0fc3 (diff)
downloadllvm-c1f523dedd7d90c02179184c55e837a9f5b8d73b.tar.gz
llvm-c1f523dedd7d90c02179184c55e837a9f5b8d73b.tar.bz2
llvm-c1f523dedd7d90c02179184c55e837a9f5b8d73b.tar.xz
Require an alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26072 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/MachineConstantPool.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h
index 1bbf88d843..0d12984ad6 100644
--- a/include/llvm/CodeGen/MachineConstantPool.h
+++ b/include/llvm/CodeGen/MachineConstantPool.h
@@ -34,18 +34,15 @@ class MachineConstantPool {
public:
/// getConstantPoolIndex - Create a new entry in the constant pool or return
- /// an existing one. User may specify an alignment that is greater than the
- /// default alignment. If one is not specified, it will be 0.
+ /// an existing one. User must specify an alignment in bytes for the object.
///
- unsigned getConstantPoolIndex(Constant *C, unsigned Alignment = 0) {
+ unsigned getConstantPoolIndex(Constant *C, unsigned Alignment) {
// Check to see if we already have this constant.
//
// FIXME, this could be made much more efficient for large constant pools.
for (unsigned i = 0, e = Constants.size(); i != e; ++i)
- if (Constants[i].first == C) {
- Constants[i].second = std::max(Constants[i].second, Alignment);
+ if (Constants[i].first == C && Constants[i].second >= Alignment)
return i;
- }
Constants.push_back(std::make_pair(C, Alignment));
return Constants.size()-1;
}