[all-commits] [llvm/llvm-project] 2adcf1: [flang] use runRegionDCE instead of a custom DCE i...

jeanPerier via All-commits all-commits at lists.llvm.org
Fri Feb 3 01:31:10 PST 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2adcf1b25d03402278892f88d467c667a6fdd938
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2023-02-03 (Fri, 03 Feb 2023)

  Changed paths:
    M flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
    M flang/test/Fir/declare-codegen.fir

  Log Message:
  [flang] use runRegionDCE instead of a custom DCE in cg-rewrite

The custom DCE in cg-rewrite is meant to get rid of fir.shape, fir.shift,
fir.shape_shift and fir.slice ops as well as their unused operands
before codegen (that does not lower those abstract operation to LLVM).

However, it turned out to be flowed in case some fir.shape operands were
unused outside of fir.shape and appeared several times as operands:
they were erased at the first appearance, causing the further attemp
to erase it to segfault (since the op IR storage was deallocated).

Instead of trying to fixing the custom DCE code, use mlir::runRegionDCE.

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

More information about the All-commits mailing list