[PATCH] D110776: A new hidden option test-changed=exe that calls exe after each time IR changes

Jamie Schmeiser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 29 14:15:53 PDT 2021


jamieschmeiser created this revision.
jamieschmeiser added a reviewer: aeubanks.
Herald added subscribers: ormris, hiraditya.
jamieschmeiser requested review of this revision.
Herald added a project: LLVM.

A new option test-changed is defined that allows one to specify an
exe that is called after each pass in the opt pipeline that changes the IR.

I recently was investigating a situation where some IR was being
mis-optimized in the IR pipeline and I needed to determine after
which pass the IR was no longer producing the correct results.
In order to determine this, I created the following option which calls
to an external exe (or script) each time the IR changes in the opt pipeline.
In my case, the exe was a script that called llc to compile the IR and ran
the result so that I could determine when it became incorrect.  This is
a generally useful technique for debugging optimization bugs.

      

The test-changed=exe option saves the IR in a temporary file and calls exe
with the name of the file and the name of the pass that just changed it after
each pass alters the IR.  exe is also called with the initial IR.  This
can be used, for example, to determine which pass corrupts the IR by having
exe as a script that calls llc and runs a test to see after which pass the
results change.  The print-changed filtering options are respected.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110776

Files:
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Other/test-changed-script.sh
  llvm/test/Other/test-changed.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110776.376030.patch
Type: text/x-patch
Size: 14534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210929/c9e92a51/attachment.bin>


More information about the llvm-commits mailing list