<div dir="ltr">I believe this is throwing several warnings for missing override keyword<div><br></div><div>







<p class="gmail-p1"><span class="gmail-s1"><b>llvm/include/llvm/Analysis/TargetTransformInfo.h:945:12: </b></span><span class="gmail-s2"><b>error: </b></span><span class="gmail-s1"><b>'getScalarizationOverhead' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]</b></span></p>
<p class="gmail-p1"><span class="gmail-s1">  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {</span></p></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Wed, Jan 25, 2017 at 11:03 PM, Jonas Paulsson via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jonpa<br>
Date: Thu Jan 26 01:03:25 2017<br>
New Revision: 293155<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=293155&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=293155&view=rev</a><br>
Log:<br>
[TargetTransformInfo]  Refactor and improve getScalarizationOverhead()<br>
<br>
Refactoring to remove duplications of this method.<br>
<br>
New method getOperandsScalarizationOverhe<wbr>ad() that looks at the present unique<br>
operands and add extract costs for them. Old behaviour was to just add extract<br>
costs for one operand of the type always, which still happens in<br>
getArithmeticInstrCost() if no operands are provided by the caller.<br>
<br>
This is a good start of improving on this, but there are more places<br>
that can be improved by using getOperandsScalarizationOverhe<wbr>ad().<br>
<br>
Review: Hal Finkel<br>
<a href="https://reviews.llvm.org/D29017" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29017</a><br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/<wbr>Analysis/TargetTransformInfo.h<br>
    llvm/trunk/include/llvm/<wbr>Analysis/<wbr>TargetTransformInfoImpl.h<br>
    llvm/trunk/include/llvm/<wbr>CodeGen/BasicTTIImpl.h<br>
    llvm/trunk/lib/Analysis/<wbr>TargetTransformInfo.cpp<br>
    llvm/trunk/lib/Target/AArch64/<wbr>AArch64TargetTransformInfo.h<br>
    llvm/trunk/lib/Target/ARM/<wbr>ARMTargetTransformInfo.h<br>
    llvm/trunk/lib/Target/X86/<wbr>X86TargetTransformInfo.cpp<br>
    llvm/trunk/lib/Target/X86/<wbr>X86TargetTransformInfo.h<br>
    llvm/trunk/lib/Transforms/<wbr>Vectorize/LoopVectorize.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/<wbr>Analysis/TargetTransformInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h?rev=293155&r1=293154&r2=293155&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/Analysis/<wbr>TargetTransformInfo.h?rev=<wbr>293155&r1=293154&r2=293155&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/<wbr>Analysis/TargetTransformInfo.h (original)<br>
+++ llvm/trunk/include/llvm/<wbr>Analysis/TargetTransformInfo.h Thu Jan 26 01:03:25 2017<br>
@@ -411,6 +411,11 @@ public:<br>
   /// containing this constant value for the target.<br>
   bool shouldBuildLookupTablesForCons<wbr>tant(Constant *C) const;<br>
<br>
+  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) const;<br>
+<br>
+  unsigned getOperandsScalarizationOverhe<wbr>ad(ArrayRef<const Value *> Args,<br>
+                                            unsigned VF) const;<br>
+<br>
   /// \brief Don't restrict interleaved unrolling to small loops.<br>
   bool enableAggressiveInterleaving(<wbr>bool LoopHasReductions) const;<br>
<br>
@@ -743,6 +748,10 @@ public:<br>
   virtual unsigned getJumpBufSize() = 0;<br>
   virtual bool shouldBuildLookupTables() = 0;<br>
   virtual bool shouldBuildLookupTablesForCons<wbr>tant(Constant *C) = 0;<br>
+  virtual unsigned<br>
+  getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) = 0;<br>
+  virtual unsigned getOperandsScalarizationOverhe<wbr>ad(ArrayRef<const Value *> Args,<br>
+                                                    unsigned VF) = 0;<br>
   virtual bool enableAggressiveInterleaving(<wbr>bool LoopHasReductions) = 0;<br>
   virtual bool enableInterleavedAccessVectori<wbr>zation() = 0;<br>
   virtual bool isFPVectorizationPotentiallyUn<wbr>safe() = 0;<br>
@@ -933,6 +942,14 @@ public:<br>
   bool shouldBuildLookupTablesForCons<wbr>tant(Constant *C) override {<br>
     return Impl.<wbr>shouldBuildLookupTablesForCons<wbr>tant(C);<br>
   }<br>
+  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {<br>
+    return Impl.getScalarizationOverhead(<wbr>Ty, Insert, Extract);<br>
+  }<br>
+  unsigned getOperandsScalarizationOverhe<wbr>ad(ArrayRef<const Value *> Args,<br>
+                                            unsigned VF) {<br>
+    return Impl.<wbr>getOperandsScalarizationOverhe<wbr>ad(Args, VF);<br>
+  }<br>
+<br>
   bool enableAggressiveInterleaving(<wbr>bool LoopHasReductions) override {<br>
     return Impl.<wbr>enableAggressiveInterleaving(<wbr>LoopHasReductions);<br>
   }<br>
<br>
Modified: llvm/trunk/include/llvm/<wbr>Analysis/<wbr>TargetTransformInfoImpl.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TargetTransformInfoImpl.h?rev=293155&r1=293154&r2=293155&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/Analysis/<wbr>TargetTransformInfoImpl.h?rev=<wbr>293155&r1=293154&r2=293155&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/<wbr>Analysis/<wbr>TargetTransformInfoImpl.h (original)<br>
+++ llvm/trunk/include/llvm/<wbr>Analysis/<wbr>TargetTransformInfoImpl.h Thu Jan 26 01:03:25 2017<br>
@@ -251,6 +251,13 @@ public:<br>
   bool shouldBuildLookupTables() { return true; }<br>
   bool shouldBuildLookupTablesForCons<wbr>tant(Constant *C) { return true; }<br>
<br>
+  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {<br>
+    return 0;<br>
+  }<br>
+<br>
+  unsigned getOperandsScalarizationOverhe<wbr>ad(ArrayRef<const Value *> Args,<br>
+                                            unsigned VF) { return 0; }<br>
+<br>
   bool enableAggressiveInterleaving(<wbr>bool LoopHasReductions) { return false; }<br>
<br>
   bool enableInterleavedAccessVectori<wbr>zation() { return false; }<br>
<br>
Modified: llvm/trunk/include/llvm/<wbr>CodeGen/BasicTTIImpl.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h?rev=293155&r1=293154&r2=293155&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/CodeGen/BasicTTIImpl.h?<wbr>rev=293155&r1=293154&r2=<wbr>293155&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/<wbr>CodeGen/BasicTTIImpl.h (original)<br>
+++ llvm/trunk/include/llvm/<wbr>CodeGen/BasicTTIImpl.h Thu Jan 26 01:03:25 2017<br>
@@ -42,24 +42,6 @@ private:<br>
   typedef TargetTransformInfoImplCRTPBas<wbr>e<T> BaseT;<br>
   typedef TargetTransformInfo TTI;<br>
<br>
-  /// Estimate the overhead of scalarizing an instruction. Insert and Extract<br>
-  /// are set if the result needs to be inserted and/or extracted from vectors.<br>
-  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {<br>
-    assert(Ty->isVectorTy() && "Can only scalarize vectors");<br>
-    unsigned Cost = 0;<br>
-<br>
-    for (int i = 0, e = Ty->getVectorNumElements(); i < e; ++i) {<br>
-      if (Insert)<br>
-        Cost += static_cast<T *>(this)<br>
-                    ->getVectorInstrCost(<wbr>Instruction::InsertElement, Ty, i);<br>
-      if (Extract)<br>
-        Cost += static_cast<T *>(this)<br>
-                    ->getVectorInstrCost(<wbr>Instruction::ExtractElement, Ty, i);<br>
-    }<br>
-<br>
-    return Cost;<br>
-  }<br>
-<br>
   /// Estimate a cost of shuffle as a sequence of extract and insert<br>
   /// operations.<br>
   unsigned getPermuteShuffleOverhead(Type *Ty) {<br>
@@ -301,6 +283,37 @@ public:<br>
<br>
   unsigned getRegisterBitWidth(bool Vector) { return 32; }<br>
<br>
+  /// Estimate the overhead of scalarizing an instruction. Insert and Extract<br>
+  /// are set if the result needs to be inserted and/or extracted from vectors.<br>
+  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {<br>
+    assert(Ty->isVectorTy() && "Can only scalarize vectors");<br>
+    unsigned Cost = 0;<br>
+<br>
+    for (int i = 0, e = Ty->getVectorNumElements(); i < e; ++i) {<br>
+      if (Insert)<br>
+        Cost += static_cast<T *>(this)<br>
+                    ->getVectorInstrCost(<wbr>Instruction::InsertElement, Ty, i);<br>
+      if (Extract)<br>
+        Cost += static_cast<T *>(this)<br>
+                    ->getVectorInstrCost(<wbr>Instruction::ExtractElement, Ty, i);<br>
+    }<br>
+<br>
+    return Cost;<br>
+  }<br>
+<br>
+  /// Estimate the overhead of scalarizing an instructions unique operands.<br>
+  unsigned getOperandsScalarizationOverhe<wbr>ad(ArrayRef<const Value *> Args,<br>
+                                            unsigned VF) {<br>
+    unsigned Cost = 0;<br>
+    SmallPtrSet<const Value*, 4> UniqueOperands;<br>
+    for (const Value *A : Args) {<br>
+      if (UniqueOperands.insert(A).<wbr>second)<br>
+        Cost += getScalarizationOverhead(<wbr>VectorType::get(A->getType(), VF),<br>
+                                         false, true);<br>
+    }<br>
+    return Cost;<br>
+  }<br>
+<br>
   unsigned getMaxInterleaveFactor(<wbr>unsigned VF) { return 1; }<br>
<br>
   unsigned getArithmeticInstrCost(<br>
@@ -341,10 +354,17 @@ public:<br>
       unsigned Num = Ty->getVectorNumElements();<br>
       unsigned Cost = static_cast<T *>(this)<br>
                           ->getArithmeticInstrCost(<wbr>Opcode, Ty->getScalarType());<br>
-      // return the cost of multiple scalar invocation plus the cost of<br>
-      // inserting<br>
-      // and extracting the values.<br>
-      return getScalarizationOverhead(Ty, true, true) + Num * Cost;<br>
+      // Return the cost of multiple scalar invocation plus the cost of<br>
+      // inserting and extracting the values.<br>
+      unsigned TotCost = getScalarizationOverhead(Ty, true, false) + Num * Cost;<br>
+      if (!Args.empty())<br>
+        TotCost += getOperandsScalarizationOverhe<wbr>ad(Args, Num);<br>
+      else<br>
+        // When no information on arguments is provided, we add the cost<br>
+        // associated with one argument as a heuristic.<br>
+        TotCost += getScalarizationOverhead(Ty, false, true);<br>
+<br>
+      return TotCost;<br>
     }<br>
<br>
     // We don't know anything about this scalar instruction.<br>
<br>
Modified: llvm/trunk/lib/Analysis/<wbr>TargetTransformInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetTransformInfo.cpp?rev=293155&r1=293154&r2=293155&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Analysis/TargetTransformInfo.<wbr>cpp?rev=293155&r1=293154&r2=<wbr>293155&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Analysis/<wbr>TargetTransformInfo.cpp (original)<br>
+++ llvm/trunk/lib/Analysis/<wbr>TargetTransformInfo.cpp Thu Jan 26 01:03:25 2017<br>
@@ -182,6 +182,17 @@ bool TargetTransformInfo::<wbr>shouldBuildLoo<br>
   return TTIImpl-><wbr>shouldBuildLookupTablesForCons<wbr>tant(C);<br>
 }<br>
<br>
+unsigned TargetTransformInfo::<br>
+getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) const {<br>
+  return TTIImpl-><wbr>getScalarizationOverhead(Ty, Insert, Extract);<br>
+}<br>
+<br>
+unsigned TargetTransformInfo::<br>
+<wbr>getOperandsScalarizationOverhe<wbr>ad(ArrayRef<const Value *> Args,<br>
+                                 unsigned VF) const {<br>
+  return TTIImpl-><wbr>getOperandsScalarizationOverhe<wbr>ad(Args, VF);<br>
+}<br>
+<br>
 bool TargetTransformInfo::<wbr>enableAggressiveInterleaving(<wbr>bool LoopHasReductions) const {<br>
   return TTIImpl-><wbr>enableAggressiveInterleaving(<wbr>LoopHasReductions);<br>
 }<br>
<br>
Modified: llvm/trunk/lib/Target/AArch64/<wbr>AArch64TargetTransformInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64TargetTransformInfo.h?rev=293155&r1=293154&r2=293155&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/Target/<wbr>AArch64/<wbr>AArch64TargetTransformInfo.h?<wbr>rev=293155&r1=293154&r2=<wbr>293155&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/AArch64/<wbr>AArch64TargetTransformInfo.h (original)<br>
+++ llvm/trunk/lib/Target/AArch64/<wbr>AArch64TargetTransformInfo.h Thu Jan 26 01:03:25 2017<br>
@@ -34,10 +34,6 @@ class AArch64TTIImpl : public BasicTTIIm<br>
   const AArch64Subtarget *ST;<br>
   const AArch64TargetLowering *TLI;<br>
<br>
-  /// Estimate the overhead of scalarizing an instruction. Insert and Extract<br>
-  /// are set if the result needs to be inserted and/or extracted from vectors.<br>
-  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract);<br>
-<br>
   const AArch64Subtarget *getST() const { return ST; }<br>
   const AArch64TargetLowering *getTLI() const { return TLI; }<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/<wbr>ARMTargetTransformInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetTransformInfo.h?rev=293155&r1=293154&r2=293155&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/Target/<wbr>ARM/ARMTargetTransformInfo.h?<wbr>rev=293155&r1=293154&r2=<wbr>293155&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/ARM/<wbr>ARMTargetTransformInfo.h (original)<br>
+++ llvm/trunk/lib/Target/ARM/<wbr>ARMTargetTransformInfo.h Thu Jan 26 01:03:25 2017<br>
@@ -33,10 +33,6 @@ class ARMTTIImpl : public BasicTTIImplBa<br>
   const ARMSubtarget *ST;<br>
   const ARMTargetLowering *TLI;<br>
<br>
-  /// Estimate the overhead of scalarizing an instruction. Insert and Extract<br>
-  /// are set if the result needs to be inserted and/or extracted from vectors.<br>
-  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract);<br>
-<br>
   const ARMSubtarget *getST() const { return ST; }<br>
   const ARMTargetLowering *getTLI() const { return TLI; }<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/X86/<wbr>X86TargetTransformInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp?rev=293155&r1=293154&r2=293155&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/Target/<wbr>X86/X86TargetTransformInfo.<wbr>cpp?rev=293155&r1=293154&r2=<wbr>293155&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/X86/<wbr>X86TargetTransformInfo.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/<wbr>X86TargetTransformInfo.cpp Thu Jan 26 01:03:25 2017<br>
@@ -1577,20 +1577,6 @@ int X86TTIImpl::<wbr>getVectorInstrCost(unsig<br>
   return BaseT::getVectorInstrCost(<wbr>Opcode, Val, Index) + RegisterFileMoveCost;<br>
 }<br>
<br>
-int X86TTIImpl::<wbr>getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {<br>
-  assert (Ty->isVectorTy() && "Can only scalarize vectors");<br>
-  int Cost = 0;<br>
-<br>
-  for (int i = 0, e = Ty->getVectorNumElements(); i < e; ++i) {<br>
-    if (Insert)<br>
-      Cost += getVectorInstrCost(<wbr>Instruction::InsertElement, Ty, i);<br>
-    if (Extract)<br>
-      Cost += getVectorInstrCost(<wbr>Instruction::ExtractElement, Ty, i);<br>
-  }<br>
-<br>
-  return Cost;<br>
-}<br>
-<br>
 int X86TTIImpl::getMemoryOpCost(<wbr>unsigned Opcode, Type *Src, unsigned Alignment,<br>
                                 unsigned AddressSpace) {<br>
   // Handle non-power-of-two vectors such as <3 x float><br>
<br>
Modified: llvm/trunk/lib/Target/X86/<wbr>X86TargetTransformInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.h?rev=293155&r1=293154&r2=293155&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/Target/<wbr>X86/X86TargetTransformInfo.h?<wbr>rev=293155&r1=293154&r2=<wbr>293155&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/X86/<wbr>X86TargetTransformInfo.h (original)<br>
+++ llvm/trunk/lib/Target/X86/<wbr>X86TargetTransformInfo.h Thu Jan 26 01:03:25 2017<br>
@@ -33,8 +33,6 @@ class X86TTIImpl : public BasicTTIImplBa<br>
   const X86Subtarget *ST;<br>
   const X86TargetLowering *TLI;<br>
<br>
-  int getScalarizationOverhead(Type *Ty, bool Insert, bool Extract);<br>
-<br>
   const X86Subtarget *getST() const { return ST; }<br>
   const X86TargetLowering *getTLI() const { return TLI; }<br>
<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Vectorize/LoopVectorize.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=293155&r1=293154&r2=293155&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Vectorize/<wbr>LoopVectorize.cpp?rev=293155&<wbr>r1=293154&r2=293155&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Vectorize/LoopVectorize.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Vectorize/LoopVectorize.cpp Thu Jan 26 01:03:25 2017<br>
@@ -3598,37 +3598,18 @@ static Value *addFastMathFlag(Value *V)<br>
   return V;<br>
 }<br>
<br>
-/// \brief Estimate the overhead of scalarizing a value based on its type.<br>
-/// Insert and Extract are set if the result needs to be inserted and/or<br>
-/// extracted from vectors.<br>
-static unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract,<br>
-                                         const TargetTransformInfo &TTI) {<br>
-  if (Ty->isVoidTy())<br>
-    return 0;<br>
-<br>
-  assert(Ty->isVectorTy() && "Can only scalarize vectors");<br>
-  unsigned Cost = 0;<br>
-<br>
-  for (unsigned I = 0, E = Ty->getVectorNumElements(); I < E; ++I) {<br>
-    if (Extract)<br>
-      Cost += TTI.getVectorInstrCost(<wbr>Instruction::ExtractElement, Ty, I);<br>
-    if (Insert)<br>
-      Cost += TTI.getVectorInstrCost(<wbr>Instruction::InsertElement, Ty, I);<br>
-  }<br>
-<br>
-  return Cost;<br>
-}<br>
-<br>
 /// \brief Estimate the overhead of scalarizing an Instruction based on the<br>
 /// types of its operands and return value.<br>
 static unsigned getScalarizationOverhead(<wbr>SmallVectorImpl<Type *> &OpTys,<br>
                                          Type *RetTy,<br>
                                          const TargetTransformInfo &TTI) {<br>
-  unsigned ScalarizationCost =<br>
-      getScalarizationOverhead(<wbr>RetTy, true, false, TTI);<br>
+  unsigned ScalarizationCost = 0;<br>
+<br>
+  if (!RetTy->isVoidTy())<br>
+    ScalarizationCost += TTI.getScalarizationOverhead(<wbr>RetTy, true, false);<br>
<br>
   for (Type *Ty : OpTys)<br>
-    ScalarizationCost += getScalarizationOverhead(Ty, false, true, TTI);<br>
+    ScalarizationCost += TTI.getScalarizationOverhead(<wbr>Ty, false, true);<br>
<br>
   return ScalarizationCost;<br>
 }<br>
@@ -3640,14 +3621,15 @@ static unsigned getScalarizationOverhead<br>
   if (VF == 1)<br>
     return 0;<br>
<br>
+  unsigned Cost = 0;<br>
   Type *RetTy = ToVectorTy(I->getType(), VF);<br>
+  if (!RetTy->isVoidTy())<br>
+    Cost += TTI.getScalarizationOverhead(<wbr>RetTy, true, false);<br>
<br>
-  SmallVector<Type *, 4> OpTys;<br>
-  unsigned OperandsNum = I->getNumOperands();<br>
-  for (unsigned OpInd = 0; OpInd < OperandsNum; ++OpInd)<br>
-    OpTys.push_back(ToVectorTy(I-><wbr>getOperand(OpInd)->getType(), VF));<br>
+  SmallVector<const Value *, 4> Operands(I->operand_values());<br>
+  Cost += TTI.<wbr>getOperandsScalarizationOverhe<wbr>ad(Operands, VF);<br>
<br>
-  return getScalarizationOverhead(<wbr>OpTys, RetTy, TTI);<br>
+  return Cost;<br>
 }<br>
<br>
 // Estimate cost of a call instruction CI if it were vectorized with factor VF.<br>
@@ -6713,8 +6695,8 @@ int LoopVectorizationCostModel::<wbr>computeP<br>
     // Compute the scalarization overhead of needed insertelement instructions<br>
     // and phi nodes.<br>
     if (Legal-><wbr>isScalarWithPredication(I) && !I->getType()->isVoidTy()) {<br>
-      ScalarCost += getScalarizationOverhead(<wbr>ToVectorTy(I->getType(), VF), true,<br>
-                                             false, TTI);<br>
+      ScalarCost += TTI.getScalarizationOverhead(<wbr>ToVectorTy(I->getType(), VF),<br>
+                                                 true, false);<br>
       ScalarCost += VF * TTI.getCFInstrCost(<wbr>Instruction::PHI);<br>
     }<br>
<br>
@@ -6729,8 +6711,8 @@ int LoopVectorizationCostModel::<wbr>computeP<br>
         if (canBeScalarized(J))<br>
           Worklist.push_back(J);<br>
         else if (needsExtract(J))<br>
-          ScalarCost += getScalarizationOverhead(<wbr>ToVectorTy(J->getType(), VF),<br>
-                                                 false, true, TTI);<br>
+          ScalarCost += TTI.getScalarizationOverhead(<br>
+                              ToVectorTy(J->getType(),VF), false, true);<br>
       }<br>
<br>
     // Scale the total scalar cost by block probability.<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>