Skip to content

Commit f9b85f3

Browse files
RKSimonmemfrob
authored andcommitted
[SROA] Pass Twine by const reference. NFCI.
Fixes clang-tidy warnings.
1 parent 3ea8f34 commit f9b85f3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,8 @@ static void speculateSelectInstLoads(SelectInst &SI) {
13981398
/// This will return the BasePtr if that is valid, or build a new GEP
13991399
/// instruction using the IRBuilder if GEP-ing is needed.
14001400
static Value *buildGEP(IRBuilderTy &IRB, Value *BasePtr,
1401-
SmallVectorImpl<Value *> &Indices, Twine NamePrefix) {
1401+
SmallVectorImpl<Value *> &Indices,
1402+
const Twine &NamePrefix) {
14021403
if (Indices.empty())
14031404
return BasePtr;
14041405

@@ -1423,7 +1424,7 @@ static Value *buildGEP(IRBuilderTy &IRB, Value *BasePtr,
14231424
static Value *getNaturalGEPWithType(IRBuilderTy &IRB, const DataLayout &DL,
14241425
Value *BasePtr, Type *Ty, Type *TargetTy,
14251426
SmallVectorImpl<Value *> &Indices,
1426-
Twine NamePrefix) {
1427+
const Twine &NamePrefix) {
14271428
if (Ty == TargetTy)
14281429
return buildGEP(IRB, BasePtr, Indices, NamePrefix);
14291430

@@ -1468,7 +1469,7 @@ static Value *getNaturalGEPRecursively(IRBuilderTy &IRB, const DataLayout &DL,
14681469
Value *Ptr, Type *Ty, APInt &Offset,
14691470
Type *TargetTy,
14701471
SmallVectorImpl<Value *> &Indices,
1471-
Twine NamePrefix) {
1472+
const Twine &NamePrefix) {
14721473
if (Offset == 0)
14731474
return getNaturalGEPWithType(IRB, DL, Ptr, Ty, TargetTy, Indices,
14741475
NamePrefix);
@@ -1543,7 +1544,7 @@ static Value *getNaturalGEPRecursively(IRBuilderTy &IRB, const DataLayout &DL,
15431544
static Value *getNaturalGEPWithOffset(IRBuilderTy &IRB, const DataLayout &DL,
15441545
Value *Ptr, APInt Offset, Type *TargetTy,
15451546
SmallVectorImpl<Value *> &Indices,
1546-
Twine NamePrefix) {
1547+
const Twine &NamePrefix) {
15471548
PointerType *Ty = cast<PointerType>(Ptr->getType());
15481549

15491550
// Don't consider any GEPs through an i8* as natural unless the TargetTy is
@@ -1584,7 +1585,8 @@ static Value *getNaturalGEPWithOffset(IRBuilderTy &IRB, const DataLayout &DL,
15841585
/// a single GEP as possible, thus making each GEP more independent of the
15851586
/// surrounding code.
15861587
static Value *getAdjustedPtr(IRBuilderTy &IRB, const DataLayout &DL, Value *Ptr,
1587-
APInt Offset, Type *PointerTy, Twine NamePrefix) {
1588+
APInt Offset, Type *PointerTy,
1589+
const Twine &NamePrefix) {
15881590
// Even though we don't look through PHI nodes, we could be called on an
15891591
// instruction in an unreachable block, which may be on a cycle.
15901592
SmallPtrSet<Value *, 4> Visited;

0 commit comments

Comments
 (0)