https://bugs.llvm.org/show_bug.cgi?id=41786

            Bug ID: 41786
           Summary: X86WinAllocaExpander::lower - Value stored to
                    'AmountReg' is never read
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedb...@nondot.org
          Reporter: llvm-...@redking.me.uk
                CC: craig.top...@gmail.com, h...@chromium.org,
                    h...@hanshq.net, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk, spatel+l...@rotateright.com

Ancient commit rL269828/rL269949

scan-build is complaining that the 'AmountReg' is written to but never read:

  unsigned AmountReg = MI->getOperand(0).getReg();
  MI->eraseFromParent();

  // Delete the definition of AmountReg, possibly walking a chain of copies.
  for (;;) {
    if (!MRI->use_empty(AmountReg))
      break;
    MachineInstr *AmountDef = MRI->getUniqueVRegDef(AmountReg);
    if (!AmountDef)
      break;
    if (AmountDef->isCopy() && AmountDef->getOperand(1).isReg())
      AmountReg = AmountDef->getOperand(1).isReg();
    AmountDef->eraseFromParent();
    break;
  }

I have no experience with this code, but the comment mentions walking the
copies, so should it be doing something like this?

    if (AmountDef->isCopy() && AmountDef->getOperand(1).isReg()) {
      AmountReg = AmountDef->getOperand(1).isReg();
      continue;
    }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to