<div dir="ltr">LGTM.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 7 February 2013 18:19, Nadav Rotem <span dir="ltr"><<a href="mailto:nrotem@apple.com" target="_blank">nrotem@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+        if (SI)<br>
+          // In case of STORE, the cost of ExtractElement from the vector.<br>
+          Cost += TTI.getVectorInstrCost(Instruction::ExtractElement, VectorTy,<br>
+                                         i);<br>
+        else<br>
+          // In case of LOAD, the cost of InsertElement into the returned<br>
+          // vector.<br>
+          Cost += TTI.getVectorInstrCost(Instruction::InsertElement, VectorTy,<br>
+                                         i);<br>
<br>
Can be written as:<br>
<br>
+          // In case of STORE, the cost of ExtractElement from the vector.<br>
+          // In case of LOAD, the cost of InsertElement into the returned vector.<br>
+          Cost += TTI.getVectorInstrCost(SI  ? Instruction::ExtractElement :  Instruction::InsertElement,<br>
                                        VectorTy, i);<br>
<br>
LGTM.   Thanks!<br>
<div><div class="h5"><br>
<br>
<br>
On Feb 7, 2013, at 10:15 AM, Arnold Schwaighofer <<a href="mailto:aschwaighofer@apple.com">aschwaighofer@apple.com</a>> wrote:<br>
<br>
> As per feedback.<br>
><br>
> We don't want too many classes in a pass and the classes obscure the details. I<br>
> was going a little overboard with object modeling here. Replace classes by<br>
> generic code that handles both loads and stores.<br>
><br>
</div></div>> <0001-Loop-Vectorizer-Refactor-Memory-Cost-Computation.patch><br>
><br>
> Thanks,<br>
> Arnold<br>
<br>
</blockquote></div><br></div>