[llvm] Add option to dump IR to files instead of stderr (PR #66412)
Nuri Amari via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 28 10:01:03 PDT 2023
================
@@ -46,6 +46,24 @@ class PrintIRInstrumentation {
void registerCallbacks(PassInstrumentationCallbacks &PIC);
private:
+ enum class SuffixType {
+ Before,
+ After,
+ Invalidated,
+ };
+
+ struct PassRunDescriptor {
+ const Module *M;
+ SmallString<128> DumpIRFilename;
----------------
NuriAmari wrote:
I did this because I use structural binding to unpack the struct, and there doesn't seem a way to have the unpacked members lose the const qualifier. I need to modify DumpIRFilename to append the suffix and I don't want to copy it unnecessarily.
```cpp
auto [M, DumpIRFilename, IRName, StoredPassID] = popPassRunDescriptor(PassID);
```
I'll just unpack the struct normally -- perhaps I got a little too excited about using structural binding.
https://github.com/llvm/llvm-project/pull/66412
More information about the llvm-commits
mailing list