From 6a7b083f322f4ac47e58cbf9d4d5fd4d1f6fecd0 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Tue, 11 Aug 2026 17:37:42 +0800 Subject: [MIR] Accept fixed-baseline LLVM syntax --- backend/unittests/Tooling/MIRReducerFuzzerTest.cpp | 2 +- backend/unittests/Tooling/PipelineDriverTest.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'backend/unittests/Tooling') diff --git a/backend/unittests/Tooling/MIRReducerFuzzerTest.cpp b/backend/unittests/Tooling/MIRReducerFuzzerTest.cpp index 236f4e9..9c95d75 100644 --- a/backend/unittests/Tooling/MIRReducerFuzzerTest.cpp +++ b/backend/unittests/Tooling/MIRReducerFuzzerTest.cpp @@ -36,7 +36,7 @@ namespace { return rcc::makeUnexpected(rcc::ErrorCode::InternalError, "test MIR does not contain the expected COPY"); } - Source.insert(Position, " %3:gpr(i64) = G_CONSTANT 99\n"); + Source.insert(Position, " %3:gprb(i64) = G_CONSTANT 99\n"); return Source; } diff --git a/backend/unittests/Tooling/PipelineDriverTest.cpp b/backend/unittests/Tooling/PipelineDriverTest.cpp index 4a223b6..b9180ce 100644 --- a/backend/unittests/Tooling/PipelineDriverTest.cpp +++ b/backend/unittests/Tooling/PipelineDriverTest.cpp @@ -214,6 +214,21 @@ int main() { if (rcc::tooling::runRV64GCPipeline(MixedInput->Document, *Target, MixedPipeline)) return tooling_test::fail("named passes must not be mixed with the default pipeline marker"); + rcc::tooling::BackendInvocation NoPassInvocation = Invocation; + NoPassInvocation.PassPipeline = {"none"}; + auto NoPassInput = rcc::tooling::parseAndCanonicalizeMIR( + "no-pass.mir", *Source, *Target, NoPassInvocation); + if (!NoPassInput) + return tooling_test::fail(NoPassInput.error().message()); + const std::string NoPassExpected = NoPassInput->Text; + auto NoPassRun = rcc::tooling::runBackend( + std::move(*NoPassInput), *Target, NoPassInvocation, + rcc::tooling::BackendOutputKind::FinalMIR); + if (!NoPassRun || !NoPassRun->Pipeline.ExecutedPasses.empty() || + NoPassRun->text() != NoPassExpected) { + return tooling_test::fail("the LLVM-compatible none pass must preserve canonical MIR"); + } + if (!SelectedMIR) return tooling_test::fail("selected MIR stage was not captured"); auto LaterInput = -- cgit v1.2.3