[llvm] r292698 - [SLP] Delete useless helper. NFC.

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 17:33:26 PST 2017


Author: mkuper
Date: Fri Jan 20 19:33:25 2017
New Revision: 292698

URL: http://llvm.org/viewvc/llvm-project?rev=292698&view=rev
Log:
[SLP] Delete useless helper. NFC.

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

Modified:
    llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=292698&r1=292697&r2=292698&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Fri Jan 20 19:33:25 2017
@@ -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");
       }
     }
 




More information about the llvm-commits mailing list