mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01: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. llvm-svn: 52690
This commit is contained in:
parent
8b2f51618a
commit
673cae8561
@ -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…
Reference in New Issue
Block a user