]> granicus.if.org Git - llvm/commitdiff
[SLP] Delete useless helper. NFC.
authorMichael Kuperstein <mkuper@google.com>
Sat, 21 Jan 2017 01:33:25 +0000 (01:33 +0000)
committerMichael Kuperstein <mkuper@google.com>
Sat, 21 Jan 2017 01:33:25 +0000 (01:33 +0000)
The helper contained a branch for a special case that is unnecessary,
and a cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292698 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/SLPVectorizer.cpp

index eba0a6a22c56e5e6ddb8b11794f1ef558688295a..717790be13ce971ccac18e6e988b32edbb1c4b6b 100644 (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");
       }
     }