[llvm-bugs] [Bug 41786] New: X86WinAllocaExpander::lower - Value stored to 'AmountReg' is never read

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 7 04:05:55 PDT 2019


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: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: craig.topper at gmail.com, hans at chromium.org,
                    hans at hanshq.net, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190507/0b83eeff/attachment.html>


More information about the llvm-bugs mailing list