[flang-commits] [PATCH] D143247: [flang] use runRegionDCE instead of a custom DCE in cg-rewrite

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Feb 3 00:43:17 PST 2023


jeanPerier created this revision.
jeanPerier added a reviewer: clementval.
jeanPerier added a project: Flang.
Herald added subscribers: bzcheeseman, sunshaoce, mehdi_amini, rriddle, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.
Herald added a subscriber: stephenneuendorffer.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143247

Files:
  flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
  flang/test/Fir/declare-codegen.fir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143247.494534.patch
Type: text/x-patch
Size: 3498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230203/8d24af4f/attachment-0001.bin>


More information about the flang-commits mailing list