<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div>On Jan 6, 2014, at 12:31 PM, "<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>" <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><br><br><div>On Sat Dec 28 2013 at 2:32:19 PM, Andrew Trick <<a href="mailto:atrick@apple.com">atrick@apple.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: atrick<br>
Date: Sat Dec 28 16:25:57 2013<br>
New Revision: 198131<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=198131&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=198131&view=rev</a><br>
Log:<br>
Uninitialized variable (in never taken path) after factoring.<br></blockquote><div><br></div><div>Generally we prefer not to initialize variables just to satisfy bad compiler warnings. Chandler especially has voiced strong opinions (that I tend to agree with) that initializing variables to satisfy compiler warnings when the code has a known invariant that makes the initialization unnecessary is counterproductive as it thwarts dynamic checkers like MSan/Valgrind/etc.<br></div></div></blockquote><div><br></div><div>Got it. In this case the warning is legit. The path was only never taken by chance because we weren't testing with a flag enabled. I've since added a test. </div><div><br></div><div>Andy </div><div><br></div><blockquote type="cite"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/<u></u>MachineScheduler.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<u></u>MachineScheduler.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineScheduler.cpp?rev=198131&r1=198130&r2=198131&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>CodeGen/MachineScheduler.cpp?<u></u>rev=198131&r1=198130&r2=<u></u>198131&view=diff</a><br>

==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/CodeGen/<u></u>MachineScheduler.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<u></u>MachineScheduler.cpp Sat Dec 28 16:25:57 2013<br>
@@ -2248,7 +2248,7 @@ void GenericSchedulerBase::<u></u>setPolicy(Can<br>
                         CurrZone.findMaxLatency(<u></u>CurrZone.Pending.elements()));<br>
<br>
   // Compute the critical resource outside the zone.<br>
-  unsigned OtherCritIdx;<br>
+  unsigned OtherCritIdx = 0;<br>
   unsigned OtherCount =<br>
     OtherZone ? OtherZone-><u></u>getOtherResourceCount(<u></u>OtherCritIdx) : 0;<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
</blockquote>
</blockquote></body></html>