This is an archive of the discontinued LLVM Phabricator instance.

[flang] Break circular dependency between FIR dialect and utilities
ClosedPublic

Authored by Renaud-K on Mar 8 2023, 7:05 PM.

Details

Summary

flang/Optimizer/Support/Utils.h has header file dependency on the FIRDialect. It also specifies that dependency in the cmake file with

DEPENDS
FIROpsIncGen
HLFIROpsIncGen

However FIRDialect links with FIRSupport which causes a circular dependency exposed by https://reviews.llvm.org/D145530 and summarily fixed by
https://reviews.llvm.org/D145602

This patch breaks up the utility libraries into 2 parts:

  1. libDialectSupport is a utility library the FIR dialect depends on and has no dependency on the dialect itself
  2. libSupport remains a utility library that depends and operates on the FIR dialect but that the dialect does not depend on.

There are some clean-ups of the DEPENDS attribute when it is redundant with link_libs

Diff Detail

Event Timeline

Renaud-K created this revision.Mar 8 2023, 7:05 PM
Renaud-K requested review of this revision.Mar 8 2023, 7:05 PM
PeteSteinfeld accepted this revision.Mar 8 2023, 8:09 PM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Mar 8 2023, 8:09 PM
Renaud-K closed this revision.Mar 9 2023, 3:34 PM

Submitted without the Differential message. My bad.

flang/lib/Optimizer/Support/CMakeLists.txt