I forgot to mention that this fix is from "Zakk <zakk0610@gmail.com>"<br /><br /><span>On 07/22/13, <b class="name">Nadav Rotem </b> <nrotem@apple.com> wrote:</span><blockquote cite="mid:20130722171048.B75902A6C030@llvm.org" class="iwcQuote" style="border-left: 1px solid #00F; padding-left: 13px; margin-left: 0;" type="cite"><div class="mimepart text plain">Author: nadav<br />Date: Mon Jul 22 12:10:48 2013<br />New Revision: 186845<br /><br />URL: <a href="http://llvm.org/viewvc/llvm-project?rev=186845&view=rev" target="l">http://llvm.org/viewvc/llvm-project?rev=186845&view=rev</a><br />Log:<br />Fix an obvious typo in the loop vectorizer where the cost model uses the wrong variable. The variable BlockCost is ignored.<br />We don't have tests for the effect of if-conversion loops because it requires a big test (that includes if-converted loops) and it is difficult to find and balance a loop to do the right thing.<br /><br /><br />Modified:<br />    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp<br /><br />Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp<br />URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=186845&r1=186844&r2=186845&view=diff" target="l">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=186845&r1=186844&r2=186845&view=diff</a><br />==============================================================================<br />--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)<br />+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Mon Jul 22 12:10:48 2013<br />@@ -4390,7 +4390,7 @@ unsigned LoopVectorizationCostModel::exp<br />         continue;<br /> <br />       unsigned C = getInstructionCost(it, VF);<br />-      Cost += C;<br />+      BlockCost += C;<br />       DEBUG(dbgs() << "LV: Found an estimated cost of "<< C <<" for VF " <<<br />             VF << " For instruction: "<< *it << "\n");<br />     }<br />@@ -4398,7 +4398,7 @@ unsigned LoopVectorizationCostModel::exp<br />     // We assume that if-converted blocks have a 50% chance of being executed.<br />     // When the code is scalar then some of the blocks are avoided due to CF.<br />     // When the code is vectorized we execute all code paths.<br />-    if (Legal->blockNeedsPredication(*bb) && VF == 1)<br />+    if (VF == 1 && Legal->blockNeedsPredication(*bb))<br />       BlockCost /= 2;<br /> <br />     Cost += BlockCost;<br /><br /><br />_______________________________________________<br />llvm-commits mailing list<br />llvm-commits@cs.uiuc.edu<br /><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="l">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br /></div></blockquote>