Add an option -print-before-changed that modifies the print-changed
behaviour so that it prints the IR before a pass that changed it in
addition to printing the IR after the pass. Note that the option
does nothing in isolation. The filtering options work as expected.
Lit tests are included.
Details
Diff Detail
Event Timeline
Could you capitalize and shorten the title a bit? Something like "Introduce -print-before-changed, making -print-changed also print before passes that modify IR"
@aeubanks, just want to point out that I have changed the option name to avoid the problem of -print-before and -print-before-changed having a common prefix. The option name is now -also-print-before. Please verify that this is acceptable and then I will deliver this.
I don't like -also-print-before, it's too generic. I'd prefer something like -print-before-changed.
@aeubanks, I agree but when I first put up this PR, there was a lit test failure and looking at the run command for the test, it had "/fuchsia.cpp -### -no-canonical-prefixes" in it, so I think the problem is that the existing -print-before is a prefix of -print-before-changed. How about -also-print-before-changed?
I thought -### added quotes to not have this sort of issue.
What exactly is the test failure?
@aeubanks, you can see the failure report by looking at Diff 1 in the history tab of the revision contents in this PR (https://reviews.llvm.org/D88757?id=295916):
linux > Clang.Driver::fuchsia.cpp
Script:
: 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/clang --driver-mode=g++ /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/fuchsia.cpp -### -no-canonical-prefixes --target=x86_64-fuchsia -ccc-install-dir /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/Inputs/basic_fuchsia_tree/bin -resource-dir=/mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir --sysroot=/mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/platform -fuse-ld=lld 2>&1 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck -check-prefixes=CHECK,CHECK-X86_64 /mnt/disks/ssd0/agent/llvm-project/clang/test/Driver/fuchsia.cpp
That failure doesn't look related to this change, looks like something else broke it. Can you repro locally?
@aeubanks, it appears that you are correct that the previous error was not caused by my changes as I cannot reproduce it locally. I have changed the option back to -print-before-changed.