diff options
author | J. Ryan Stinnett <jryans@gmail.com> | 2022-08-25 23:50:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-25 18:50:17 -0400 |
commit | 219f0610c4df1cc2c0b6e53c5f4737e5c6bd275f (patch) | |
tree | fe54679a1c21abfb53a7de2d430a8068b41176e0 | |
parent | 223cd8f5e2bef7639aed9cc02c817b8b9db3d686 (diff) | |
download | compiler-explorer-gh-4033.tar.gz compiler-explorer-gh-4033.zip |
Ensure first MIR pass marked as changed (#3988)gh-4033
-rw-r--r-- | lib/parsers/llvm-pass-dump-parser.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/parsers/llvm-pass-dump-parser.ts b/lib/parsers/llvm-pass-dump-parser.ts index ecb62fed3..2ec32ce67 100644 --- a/lib/parsers/llvm-pass-dump-parser.ts +++ b/lib/parsers/llvm-pass-dump-parser.ts @@ -410,6 +410,17 @@ export class LlvmPassDumpParser { assert(false, 'Unexpected pass header', current_dump.header); } pass.machine = current_dump.machine; + + // The first machine pass outputs the same MIR before and after, + // making it seem like it did nothing. + // Assuming we ran some IR pass before this, grab its output as + // the before text, ensuring the first MIR pass appears when + // inconsequential passes are filtered away. + const previousPass = passes.at(-1); + if (previousPass && previousPass.machine !== pass.machine) { + pass.before = previousPass.after; + } + // check for equality pass.irChanged = pass.before.map(x => x.text).join('\n') !== pass.after.map(x => x.text).join('\n'); passes.push(pass); |