[SLP] Delete useless helper. NFC.

The helper contained a branch for a special case that is unnecessary,
and a cast.

llvm-svn: 292698
This commit is contained in:
Michael Kuperstein 2017-01-21 01:33:25 +00:00
parent 6bfbcd099e
commit f8458593cf
1 changed files with 10 additions and 14 deletions

View File

@ -4302,8 +4302,9 @@ public:
Value *ReducedSubTree = emitReduction(VectorizedRoot, Builder);
if (VectorizedTree) {
Builder.SetCurrentDebugLocation(Loc);
VectorizedTree = createBinOp(Builder, ReductionOpcode, VectorizedTree,
ReducedSubTree, "bin.rdx");
VectorizedTree =
Builder.CreateBinOp((Instruction::BinaryOps)ReductionOpcode,
VectorizedTree, ReducedSubTree, "bin.rdx");
} else
VectorizedTree = ReducedSubTree;
}
@ -4313,8 +4314,9 @@ public:
for (; i < NumReducedVals; ++i) {
Builder.SetCurrentDebugLocation(
cast<Instruction>(ReducedVals[i])->getDebugLoc());
VectorizedTree = createBinOp(Builder, ReductionOpcode, VectorizedTree,
ReducedVals[i]);
VectorizedTree =
Builder.CreateBinOp((Instruction::BinaryOps)ReductionOpcode,
VectorizedTree, ReducedVals[i]);
}
// Update users.
if (ReductionPHI && !isa<UndefValue>(ReductionPHI)) {
@ -4356,13 +4358,6 @@ private:
return VecReduxCost - ScalarReduxCost;
}
static Value *createBinOp(IRBuilder<> &Builder, unsigned Opcode, Value *L,
Value *R, const Twine &Name = "") {
if (Opcode == Instruction::FAdd)
return Builder.CreateFAdd(L, R, Name);
return Builder.CreateBinOp((Instruction::BinaryOps)Opcode, L, R, Name);
}
/// \brief Emit a horizontal reduction of the vectorized value.
Value *emitReduction(Value *VectorizedValue, IRBuilder<> &Builder) {
assert(VectorizedValue && "Need to have a vectorized tree node");
@ -4382,14 +4377,15 @@ private:
Value *RightShuf = Builder.CreateShuffleVector(
TmpVec, UndefValue::get(TmpVec->getType()), (RightMask),
"rdx.shuf.r");
TmpVec = createBinOp(Builder, ReductionOpcode, LeftShuf, RightShuf,
"bin.rdx");
TmpVec = Builder.CreateBinOp((Instruction::BinaryOps)ReductionOpcode,
LeftShuf, RightShuf, "bin.rdx");
} else {
Value *UpperHalf =
createRdxShuffleMask(ReduxWidth, i, false, false, Builder);
Value *Shuf = Builder.CreateShuffleVector(
TmpVec, UndefValue::get(TmpVec->getType()), UpperHalf, "rdx.shuf");
TmpVec = createBinOp(Builder, ReductionOpcode, TmpVec, Shuf, "bin.rdx");
TmpVec = Builder.CreateBinOp((Instruction::BinaryOps)ReductionOpcode,
TmpVec, Shuf, "bin.rdx");
}
}