This is an archive of the discontinued LLVM Phabricator instance.

[flang] use runRegionDCE instead of a custom DCE in cg-rewrite
ClosedPublic

Authored by jeanPerier on Feb 3 2023, 12:43 AM.

Details

Summary

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.

Diff Detail

Event Timeline

jeanPerier created this revision.Feb 3 2023, 12:43 AM
jeanPerier requested review of this revision.Feb 3 2023, 12:43 AM
clementval accepted this revision.Feb 3 2023, 12:56 AM

Nice cleanup! LGTM

This revision is now accepted and ready to land.Feb 3 2023, 12:56 AM