Fix uninitialized memory read found by MemorySanitizer: always set output parameter...
authorAlexey Samsonov <samsonov@google.com>
Fri, 19 Jul 2013 08:55:18 +0000 (08:55 +0000)
committerAlexey Samsonov <samsonov@google.com>
Fri, 19 Jul 2013 08:55:18 +0000 (08:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186658 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineScheduler.cpp

index 314f621c09273940039f08c15238025a939f5bab..2ee8775f2c4e4781b9c75d68aac12fc89febf810 100644 (file)
@@ -1593,6 +1593,7 @@ findMaxLatency(ArrayRef<SUnit*> ReadySUs) {
 // resource index, or zero if the zone is issue limited.
 unsigned ConvergingScheduler::SchedBoundary::
 getOtherResourceCount(unsigned &OtherCritIdx) {
+  OtherCritIdx = 0;
   if (!SchedModel->hasInstrSchedModel())
     return 0;
 
@@ -1600,7 +1601,6 @@ getOtherResourceCount(unsigned &OtherCritIdx) {
     + (RetiredMOps * SchedModel->getMicroOpFactor());
   DEBUG(dbgs() << "  " << Available.getName() << " + Remain MOps: "
         << OtherCritCount / SchedModel->getMicroOpFactor() << '\n');
-  OtherCritIdx = 0;
   for (unsigned PIdx = 1, PEnd = SchedModel->getNumProcResourceKinds();
        PIdx != PEnd; ++PIdx) {
     unsigned OtherCount = getResourceCount(PIdx) + Rem->RemainingCounts[PIdx];