[llvm-bugs] [Bug 39669] New: GlobalDCE.cpp / isEmptyFunction doesn't skip debug intrinsics

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 14 14:41:05 PST 2018


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

            Bug ID: 39669
           Summary: GlobalDCE.cpp / isEmptyFunction doesn't skip debug
                    intrinsics
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: aprantl at apple.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org

GlobalDCE.cpp / isEmptyFunction is defined as follows:

/// Returns true if F contains only a single "ret" instruction.
static bool isEmptyFunction(Function *F) {
  BasicBlock &Entry = F->getEntryBlock();
  if (Entry.size() != 1 || !isa<ReturnInst>(Entry.front()))
    return false;
  ReturnInst &RI = cast<ReturnInst>(Entry.front());
  return RI.getReturnValue() == nullptr;
}

used thusly:

  // Remove empty functions from the global ctors list.
  Changed |= optimizeGlobalCtorsList(M, isEmptyFunction);


If I'm reading this correctly, this means that the presence of debug info could
change the behavior of the optimization, which would be a bug.

-- 
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/20181114/bc90a14f/attachment.html>


More information about the llvm-bugs mailing list