mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-14 17:34:41 +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:
parent
873e1b5642
commit
45e3958941
@ -1378,8 +1378,9 @@ bool ConstantArray::isCString() const {
|
||||
std::string ConstantArray::getAsString() const {
|
||||
assert(isString() && "Not a string!");
|
||||
std::string Result;
|
||||
Result.reserve(getNumOperands());
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user