[llvm] Register assembly printer passes (PR #138348)
Akshat Oke via llvm-commits
llvm-commits at lists.llvm.org
Thu May 15 03:30:42 PDT 2025
================
@@ -1,4 +1,4 @@
-# RUN: llc -mtriple=riscv32 -verify-machineinstrs -start-before=riscv-expand-pseudo -simplify-mir -o /dev/null -pass-remarks-analysis=asm-printer %s 2>&1 | FileCheck %s
+# RUN: llc -mtriple=riscv32 -verify-machineinstrs -start-before=riscv-asm-printer -simplify-mir -o /dev/null -pass-remarks-analysis=asm-printer %s 2>&1 | FileCheck %s
----------------
optimisan wrote:
Since this was passing I didn't review too closely, but all of these tests are passing for the wrong reasons:
`TargetPassConfig` does not handle the AsmPrinter; it is directly added to the pipeline outside of `TargetPassConfig`. Rather, what it does handle is determining if the pass pipeline runs till the AsmPrinter (which is incorrectly named `willCompleteCodeGenPipeline`). Based on this, either AsmPrinter or MIRPrinter pass is added at the end.
Problem is `TargetPassConfig` does not check if the provided passes in these pipeline-slicing options actually are in the pipeline -- if they match we slice, else we do nothing.
So here we can substitute `riscv-asm-printer` with any pass that is not in the pipeline (try something like `irtranslator` or `x86-asm-printer`.
Further, this test fails on qualifying this (without changing the pipeline) with `-stop-after=riscv-asm-printer` (why? Because `willCompleteCodegenPipeline` does not properly check if indeed said pass was in the pipeline)
All in all `-stop-before=xx-asm-printer` and `-start-before=xx-asm-printer` work as intended, but `-stop-after` and `-start-after` do not (they do the same thing as their "before" counterparts)
I'm not sure if we should try to fix this; this issue is already fixed in the NPM path and no tests reference asm-printer like this.
https://github.com/llvm/llvm-project/pull/138348
More information about the llvm-commits
mailing list