]> granicus.if.org Git - llvm/commitdiff
[X86]: Fix for uninitialized access introduced in r272797.
authorKevin B. Smith <kevin.b.smith@intel.com>
Wed, 15 Jun 2016 20:52:19 +0000 (20:52 +0000)
committerKevin B. Smith <kevin.b.smith@intel.com>
Wed, 15 Jun 2016 20:52:19 +0000 (20:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272835 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86FixupBWInsts.cpp

index 5fb0e219ab4ddb0ec705addc510375821363c246..792158666993962203ec01d9bab933959d5a04b6 100644 (file)
@@ -372,12 +372,16 @@ void FixupBWInstPass::processBasicBlock(MachineFunction &MF,
     LiveRegs.addLiveIns(MBB);
 
     auto NextCandidateIter = MIReplacements.begin();
+    auto EndCandidateIter = MIReplacements.end();
 
     for (auto I = MBB.begin(); I != MBB.end(); ++I) {
       MachineInstr *MI = &*I;
       SmallVector<std::pair<unsigned, const MachineOperand*>, 4> Clobbers;
       LiveRegs.stepForward(*MI, Clobbers);
 
+      if (NextCandidateIter == EndCandidateIter)
+        break;
+
       // Only check and create a new instruction if this instruction is
       // known to be a candidate that didn't get transformed.
       if (NextCandidateIter->first == MI) {