From 8c72b0271b841c75e2f005b796fbdbbbbd143ad4 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 12 May 2020 09:43:24 -0700 Subject: [CodeGen] Use Align in MachineConstantPool. --- llvm/lib/CodeGen/MachineFunction.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'llvm/lib/CodeGen/MachineFunction.cpp') diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 464f389..7a2d573 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -1176,8 +1176,7 @@ static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B, /// Create a new entry in the constant pool or return an existing one. /// User must specify the log2 of the minimum required alignment for the object. unsigned MachineConstantPool::getConstantPoolIndex(const Constant *C, - unsigned Alignment) { - assert(Alignment && "Alignment must be specified!"); + Align Alignment) { if (Alignment > PoolAlignment) PoolAlignment = Alignment; // Check to see if we already have this constant. @@ -1186,7 +1185,7 @@ unsigned MachineConstantPool::getConstantPoolIndex(const Constant *C, for (unsigned i = 0, e = Constants.size(); i != e; ++i) if (!Constants[i].isMachineConstantPoolEntry() && CanShareConstantPoolEntry(Constants[i].Val.ConstVal, C, DL)) { - if ((unsigned)Constants[i].getAlignment() < Alignment) + if (Constants[i].getAlign() < Alignment) Constants[i].Alignment = Alignment; return i; } @@ -1196,8 +1195,7 @@ unsigned MachineConstantPool::getConstantPoolIndex(const Constant *C, } unsigned MachineConstantPool::getConstantPoolIndex(MachineConstantPoolValue *V, - unsigned Alignment) { - assert(Alignment && "Alignment must be specified!"); + Align Alignment) { if (Alignment > PoolAlignment) PoolAlignment = Alignment; // Check to see if we already have this constant. @@ -1223,7 +1221,7 @@ void MachineConstantPool::print(raw_ostream &OS) const { Constants[i].Val.MachineCPVal->print(OS); else Constants[i].Val.ConstVal->printAsOperand(OS, /*PrintType=*/false); - OS << ", align=" << Constants[i].getAlignment(); + OS << ", align=" << Constants[i].getAlign().value(); OS << "\n"; } } -- cgit v1.1