diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Object/Error.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Support/Error.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Support/Twine.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/SROA.cpp | 21 |
4 files changed, 18 insertions, 16 deletions
diff --git a/llvm/lib/Object/Error.cpp b/llvm/lib/Object/Error.cpp index d4ab9163886..7d43a84f3e0 100644 --- a/llvm/lib/Object/Error.cpp +++ b/llvm/lib/Object/Error.cpp @@ -60,10 +60,9 @@ std::string _object_error_category::message(int EV) const { char BinaryError::ID = 0; char GenericBinaryError::ID = 0; -GenericBinaryError::GenericBinaryError(const Twine &Msg) : Msg(Msg.str()) {} +GenericBinaryError::GenericBinaryError(Twine Msg) : Msg(Msg.str()) {} -GenericBinaryError::GenericBinaryError(const Twine &Msg, - object_error ECOverride) +GenericBinaryError::GenericBinaryError(Twine Msg, object_error ECOverride) : Msg(Msg.str()) { setErrorCode(make_error_code(ECOverride)); } diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp index fe8ffd817f4..bb02c03ff2b 100644 --- a/llvm/lib/Support/Error.cpp +++ b/llvm/lib/Support/Error.cpp @@ -54,7 +54,7 @@ char ErrorList::ID = 0; char ECError::ID = 0; char StringError::ID = 0; -void logAllUnhandledErrors(Error E, raw_ostream &OS, const Twine &ErrorBanner) { +void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner) { if (!E) return; OS << ErrorBanner; diff --git a/llvm/lib/Support/Twine.cpp b/llvm/lib/Support/Twine.cpp index bf434f34e43..d17cd4e6643 100644 --- a/llvm/lib/Support/Twine.cpp +++ b/llvm/lib/Support/Twine.cpp @@ -120,10 +120,12 @@ void Twine::printOneChildRepr(raw_ostream &OS, Child Ptr, << Ptr.cString << "\""; break; case Twine::StdStringKind: - OS << "std::string:\"" << *Ptr.stdString << "\""; + OS << "std::string:\"" + << Ptr.stdString << "\""; break; case Twine::StringRefKind: - OS << "stringref:\"" << *Ptr.stringRef << "\""; + OS << "stringref:\"" + << Ptr.stringRef << "\""; break; case Twine::SmallStringKind: OS << "smallstring:\"" << *Ptr.smallString << "\""; diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index c64c0408758..b968cb8c892 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -130,15 +130,18 @@ namespace { class IRBuilderPrefixedInserter : public IRBuilderDefaultInserter { std::string Prefix; + const Twine getNameWithPrefix(const Twine &Name) const { + return Name.isTriviallyEmpty() ? Name : Prefix + Name; + } + public: void SetNamePrefix(const Twine &P) { Prefix = P.str(); } protected: void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const { - const Twine &Prefixed = Prefix + Name; - IRBuilderDefaultInserter::InsertHelper( - I, Name.isTriviallyEmpty() ? Name : Prefixed, BB, InsertPt); + IRBuilderDefaultInserter::InsertHelper(I, getNameWithPrefix(Name), BB, + InsertPt); } }; @@ -1352,8 +1355,7 @@ static void speculateSelectInstLoads(SelectInst &SI) { /// This will return the BasePtr if that is valid, or build a new GEP /// instruction using the IRBuilder if GEP-ing is needed. static Value *buildGEP(IRBuilderTy &IRB, Value *BasePtr, - SmallVectorImpl<Value *> &Indices, - const Twine &NamePrefix) { + SmallVectorImpl<Value *> &Indices, Twine NamePrefix) { if (Indices.empty()) return BasePtr; @@ -1378,7 +1380,7 @@ static Value *buildGEP(IRBuilderTy &IRB, Value *BasePtr, static Value *getNaturalGEPWithType(IRBuilderTy &IRB, const DataLayout &DL, Value *BasePtr, Type *Ty, Type *TargetTy, SmallVectorImpl<Value *> &Indices, - const Twine &NamePrefix) { + Twine NamePrefix) { if (Ty == TargetTy) return buildGEP(IRB, BasePtr, Indices, NamePrefix); @@ -1423,7 +1425,7 @@ static Value *getNaturalGEPRecursively(IRBuilderTy &IRB, const DataLayout &DL, Value *Ptr, Type *Ty, APInt &Offset, Type *TargetTy, SmallVectorImpl<Value *> &Indices, - const Twine &NamePrefix) { + Twine NamePrefix) { if (Offset == 0) return getNaturalGEPWithType(IRB, DL, Ptr, Ty, TargetTy, Indices, NamePrefix); @@ -1496,7 +1498,7 @@ static Value *getNaturalGEPRecursively(IRBuilderTy &IRB, const DataLayout &DL, static Value *getNaturalGEPWithOffset(IRBuilderTy &IRB, const DataLayout &DL, Value *Ptr, APInt Offset, Type *TargetTy, SmallVectorImpl<Value *> &Indices, - const Twine &NamePrefix) { + Twine NamePrefix) { PointerType *Ty = cast<PointerType>(Ptr->getType()); // Don't consider any GEPs through an i8* as natural unless the TargetTy is @@ -1534,8 +1536,7 @@ static Value *getNaturalGEPWithOffset(IRBuilderTy &IRB, const DataLayout &DL, /// a single GEP as possible, thus making each GEP more independent of the /// surrounding code. static Value *getAdjustedPtr(IRBuilderTy &IRB, const DataLayout &DL, Value *Ptr, - APInt Offset, Type *PointerTy, - const Twine &NamePrefix) { + APInt Offset, Type *PointerTy, Twine NamePrefix) { // Even though we don't look through PHI nodes, we could be called on an // instruction in an unreachable block, which may be on a cycle. SmallPtrSet<Value *, 4> Visited; |