Add option to dump IR to files instead of stderr (#66412)

This patch adds a flag to LLVM such that the output generated by the
family of flags is written to files in a directory rather than to

This new flag is `-ir-dump-directory` and is used to specify where to
write the files. No other flags are added, it just modifies the behavior
of the print flags.

This is a second simplified version of the changes proposed in

This patch only adds support for the new pass manager. If this patch is
accepted, similar support can be added to the legacy pass manager.

Co-authored-by: Nuri Amari <>
GitOrigin-RevId: c718336c4cb14e27aa88054cc30ee0c2fc6505d1
4 files changed