Skip to content

Commit 3e8840b

Browse files
committed
Remove "Target" from createXReduction naming [nfc]
Despite the stale comments, none of these actually use TTI, and they're solely generating standard LLVM IR.
1 parent b076f66 commit 3e8840b

File tree

6 files changed

+38
-42
lines changed

6 files changed

+38
-42
lines changed

llvm/include/llvm/IR/VectorBuilder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ class VectorBuilder {
103103
/// \param ValTy The type of operand which the reduction operation is
104104
/// performed.
105105
/// \param VecOpArray The operand list.
106-
Value *createSimpleTargetReduction(Intrinsic::ID RdxID, Type *ValTy,
107-
ArrayRef<Value *> VecOpArray,
108-
const Twine &Name = Twine());
106+
Value *createSimpleReduction(Intrinsic::ID RdxID, Type *ValTy,
107+
ArrayRef<Value *> VecOpArray,
108+
const Twine &Name = Twine());
109109
};
110110

111111
} // namespace llvm

llvm/include/llvm/Transforms/Utils/LoopUtils.h

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -393,32 +393,28 @@ Value *getShuffleReduction(IRBuilderBase &Builder, Value *Src, unsigned Op,
393393
TargetTransformInfo::ReductionShuffle RS,
394394
RecurKind MinMaxKind = RecurKind::None);
395395

396-
/// Create a target reduction of the given vector. The reduction operation
396+
/// Create a reduction of the given vector. The reduction operation
397397
/// is described by the \p Opcode parameter. min/max reductions require
398398
/// additional information supplied in \p RdxKind.
399-
/// The target is queried to determine if intrinsics or shuffle sequences are
400-
/// required to implement the reduction.
401399
/// Fast-math-flags are propagated using the IRBuilder's setting.
402-
Value *createSimpleTargetReduction(IRBuilderBase &B, Value *Src,
403-
RecurKind RdxKind);
404-
/// Overloaded function to generate vector-predication intrinsics for target
400+
Value *createSimpleReduction(IRBuilderBase &B, Value *Src,
401+
RecurKind RdxKind);
402+
/// Overloaded function to generate vector-predication intrinsics for
405403
/// reduction.
406-
Value *createSimpleTargetReduction(VectorBuilder &VB, Value *Src,
407-
const RecurrenceDescriptor &Desc);
404+
Value *createSimpleReduction(VectorBuilder &VB, Value *Src,
405+
const RecurrenceDescriptor &Desc);
408406

409-
/// Create a target reduction of the given vector \p Src for a reduction of the
407+
/// Create a reduction of the given vector \p Src for a reduction of the
410408
/// kind RecurKind::IAnyOf or RecurKind::FAnyOf. The reduction operation is
411409
/// described by \p Desc.
412-
Value *createAnyOfTargetReduction(IRBuilderBase &B, Value *Src,
413-
const RecurrenceDescriptor &Desc,
414-
PHINode *OrigPhi);
410+
Value *createAnyOfReduction(IRBuilderBase &B, Value *Src,
411+
const RecurrenceDescriptor &Desc,
412+
PHINode *OrigPhi);
415413

416-
/// Create a generic target reduction using a recurrence descriptor \p Desc
417-
/// The target is queried to determine if intrinsics or shuffle sequences are
418-
/// required to implement the reduction.
414+
/// Create a generic reduction using a recurrence descriptor \p Desc
419415
/// Fast-math-flags are propagated using the RecurrenceDescriptor.
420-
Value *createTargetReduction(IRBuilderBase &B, const RecurrenceDescriptor &Desc,
421-
Value *Src, PHINode *OrigPhi = nullptr);
416+
Value *createReduction(IRBuilderBase &B, const RecurrenceDescriptor &Desc,
417+
Value *Src, PHINode *OrigPhi = nullptr);
422418

423419
/// Create an ordered reduction intrinsic using the given recurrence
424420
/// descriptor \p Desc.

llvm/lib/IR/VectorBuilder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ Value *VectorBuilder::createVectorInstruction(unsigned Opcode, Type *ReturnTy,
6060
return createVectorInstructionImpl(VPID, ReturnTy, InstOpArray, Name);
6161
}
6262

63-
Value *VectorBuilder::createSimpleTargetReduction(Intrinsic::ID RdxID,
64-
Type *ValTy,
65-
ArrayRef<Value *> InstOpArray,
66-
const Twine &Name) {
63+
Value *VectorBuilder::createSimpleReduction(Intrinsic::ID RdxID,
64+
Type *ValTy,
65+
ArrayRef<Value *> InstOpArray,
66+
const Twine &Name) {
6767
auto VPID = VPIntrinsic::getForIntrinsic(RdxID);
6868
assert(VPReductionIntrinsic::isVPReduction(VPID) &&
6969
"No VPIntrinsic for this reduction");

llvm/lib/Transforms/Utils/LoopUtils.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,9 +1172,9 @@ Value *llvm::getShuffleReduction(IRBuilderBase &Builder, Value *Src,
11721172
return Builder.CreateExtractElement(TmpVec, Builder.getInt32(0));
11731173
}
11741174

1175-
Value *llvm::createAnyOfTargetReduction(IRBuilderBase &Builder, Value *Src,
1176-
const RecurrenceDescriptor &Desc,
1177-
PHINode *OrigPhi) {
1175+
Value *llvm::createAnyOfReduction(IRBuilderBase &Builder, Value *Src,
1176+
const RecurrenceDescriptor &Desc,
1177+
PHINode *OrigPhi) {
11781178
assert(
11791179
RecurrenceDescriptor::isAnyOfRecurrenceKind(Desc.getRecurrenceKind()) &&
11801180
"Unexpected reduction kind");
@@ -1207,8 +1207,8 @@ Value *llvm::createAnyOfTargetReduction(IRBuilderBase &Builder, Value *Src,
12071207
return Builder.CreateSelect(AnyOf, NewVal, InitVal, "rdx.select");
12081208
}
12091209

1210-
Value *llvm::createSimpleTargetReduction(IRBuilderBase &Builder, Value *Src,
1211-
RecurKind RdxKind) {
1210+
Value *llvm::createSimpleReduction(IRBuilderBase &Builder, Value *Src,
1211+
RecurKind RdxKind) {
12121212
auto *SrcVecEltTy = cast<VectorType>(Src->getType())->getElementType();
12131213
auto getIdentity = [&]() {
12141214
Intrinsic::ID ID = getReductionIntrinsicID(RdxKind);
@@ -1241,8 +1241,8 @@ Value *llvm::createSimpleTargetReduction(IRBuilderBase &Builder, Value *Src,
12411241
}
12421242
}
12431243

1244-
Value *llvm::createSimpleTargetReduction(VectorBuilder &VBuilder, Value *Src,
1245-
const RecurrenceDescriptor &Desc) {
1244+
Value *llvm::createSimpleReduction(VectorBuilder &VBuilder, Value *Src,
1245+
const RecurrenceDescriptor &Desc) {
12461246
RecurKind Kind = Desc.getRecurrenceKind();
12471247
assert(!RecurrenceDescriptor::isAnyOfRecurrenceKind(Kind) &&
12481248
"AnyOf reduction is not supported.");
@@ -1252,12 +1252,12 @@ Value *llvm::createSimpleTargetReduction(VectorBuilder &VBuilder, Value *Src,
12521252
Value *Iden =
12531253
Desc.getRecurrenceIdentity(Kind, SrcEltTy, Desc.getFastMathFlags());
12541254
Value *Ops[] = {Iden, Src};
1255-
return VBuilder.createSimpleTargetReduction(Id, SrcTy, Ops);
1255+
return VBuilder.createSimpleReduction(Id, SrcTy, Ops);
12561256
}
12571257

1258-
Value *llvm::createTargetReduction(IRBuilderBase &B,
1259-
const RecurrenceDescriptor &Desc, Value *Src,
1260-
PHINode *OrigPhi) {
1258+
Value *llvm::createReduction(IRBuilderBase &B,
1259+
const RecurrenceDescriptor &Desc, Value *Src,
1260+
PHINode *OrigPhi) {
12611261
// TODO: Support in-order reductions based on the recurrence descriptor.
12621262
// All ops in the reduction inherit fast-math-flags from the recurrence
12631263
// descriptor.
@@ -1266,9 +1266,9 @@ Value *llvm::createTargetReduction(IRBuilderBase &B,
12661266

12671267
RecurKind RK = Desc.getRecurrenceKind();
12681268
if (RecurrenceDescriptor::isAnyOfRecurrenceKind(RK))
1269-
return createAnyOfTargetReduction(B, Src, Desc, OrigPhi);
1269+
return createAnyOfReduction(B, Src, Desc, OrigPhi);
12701270

1271-
return createSimpleTargetReduction(B, Src, RK);
1271+
return createSimpleReduction(B, Src, RK);
12721272
}
12731273

12741274
Value *llvm::createOrderedReduction(IRBuilderBase &B,
@@ -1295,7 +1295,7 @@ Value *llvm::createOrderedReduction(VectorBuilder &VBuilder,
12951295
Intrinsic::ID Id = getReductionIntrinsicID(RecurKind::FAdd);
12961296
auto *SrcTy = cast<VectorType>(Src->getType());
12971297
Value *Ops[] = {Start, Src};
1298-
return VBuilder.createSimpleTargetReduction(Id, SrcTy, Ops);
1298+
return VBuilder.createSimpleReduction(Id, SrcTy, Ops);
12991299
}
13001300

13011301
void llvm::propagateIRFlags(Value *I, ArrayRef<Value *> VL, Value *OpValue,

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18351,7 +18351,7 @@ class HorizontalReduction {
1835118351
"A call to the llvm.fmuladd intrinsic is not handled yet");
1835218352

1835318353
++NumVectorInstructions;
18354-
return createSimpleTargetReduction(Builder, VectorizedValue, RdxKind);
18354+
return createSimpleReduction(Builder, VectorizedValue, RdxKind);
1835518355
}
1835618356

1835718357
/// Emits optimized code for unique scalar value reused \p Cnt times.

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ Value *VPInstruction::generatePerPart(VPTransformState &State, unsigned Part) {
593593
RecurrenceDescriptor::isAnyOfRecurrenceKind(RK)) &&
594594
!PhiR->isInLoop()) {
595595
ReducedPartRdx =
596-
createTargetReduction(Builder, RdxDesc, ReducedPartRdx, OrigPhi);
596+
createReduction(Builder, RdxDesc, ReducedPartRdx, OrigPhi);
597597
// If the reduction can be performed in a smaller type, we need to extend
598598
// the reduction to the wider type before we branch to the original loop.
599599
if (PhiTy != RdxDesc.getRecurrenceType())
@@ -1857,7 +1857,7 @@ void VPReductionRecipe::execute(VPTransformState &State) {
18571857
NextInChain = NewRed;
18581858
} else {
18591859
PrevInChain = State.get(getChainOp(), Part, /*IsScalar*/ true);
1860-
NewRed = createTargetReduction(State.Builder, RdxDesc, NewVecOp);
1860+
NewRed = createReduction(State.Builder, RdxDesc, NewVecOp);
18611861
if (RecurrenceDescriptor::isMinMaxRecurrenceKind(Kind))
18621862
NextInChain = createMinMaxOp(State.Builder, RdxDesc.getRecurrenceKind(),
18631863
NewRed, PrevInChain);
@@ -1900,7 +1900,7 @@ void VPReductionEVLRecipe::execute(VPTransformState &State) {
19001900
if (isOrdered()) {
19011901
NewRed = createOrderedReduction(VBuilder, RdxDesc, VecOp, Prev);
19021902
} else {
1903-
NewRed = createSimpleTargetReduction(VBuilder, VecOp, RdxDesc);
1903+
NewRed = createSimpleReduction(VBuilder, VecOp, RdxDesc);
19041904
if (RecurrenceDescriptor::isMinMaxRecurrenceKind(Kind))
19051905
NewRed = createMinMaxOp(Builder, Kind, NewRed, Prev);
19061906
else

0 commit comments

Comments
 (0)