mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
In ConstantArray::getAsString(), we know the size of the resultant string in advance so we can pre-allocate it and just fill in
the entries. This improves the time for the AsmPrinter on InstructionCombining.cpp from 0.4248s to 0.3370s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1378,8 +1378,9 @@ bool ConstantArray::isCString() const {
|
|||||||
std::string ConstantArray::getAsString() const {
|
std::string ConstantArray::getAsString() const {
|
||||||
assert(isString() && "Not a string!");
|
assert(isString() && "Not a string!");
|
||||||
std::string Result;
|
std::string Result;
|
||||||
|
Result.reserve(getNumOperands());
|
||||||
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
|
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
|
||||||
Result += (char)cast<ConstantInt>(getOperand(i))->getZExtValue();
|
Result[i] = (char)cast<ConstantInt>(getOperand(i))->getZExtValue();
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user