[all-commits] [llvm/llvm-project] 62fe67: [mlir][DCA] Fix visiting call ops when run at func...

Jeff Niu via All-commits all-commits at lists.llvm.org
Sun Jul 31 13:04:00 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 62fe67f9eb02cd5add1f70514fdcd1b324b14028
  Author: Jeff Niu <jeff at modular.com>
  Date:   2022-07-31 (Sun, 31 Jul 2022)

  Changed paths:
    M mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h
    M mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp
    M mlir/test/Transforms/sccp-callgraph.mlir

  Log Message:
  [mlir][DCA] Fix visiting call ops when run at function scopes

When dead-code analysis is run at the scope of a function, call ops to
other functions at the same level were being marked as unreachable,
since the analysis optimistically assumes the call op to have no known
predecessors and that all predecessors are known, but the callee would
never get visited.

This patch fixes the bug by checking if a referenced function is above
the top-level op of the analysis, and is thus considered an external

Fixes #56830

Reviewed By: zero9178

Differential Revision: https://reviews.llvm.org/D130829

More information about the All-commits mailing list