[llvm] [llvm-reduce] Set the target triple before parsing machine functions (PR #189989)
Dominik Montada via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 09:02:22 PDT 2026
https://github.com/gargaroff created https://github.com/llvm/llvm-project/pull/189989
Make sure that the module has a target triple set before trying to parse machine functions. This can be required for (downstream) targets if MIR parsing relies on features guarded by the target triple.
>From fa374b5dfe3d52de95d467cff2926d21f2ffd721 Mon Sep 17 00:00:00 2001
From: Dominik Montada <dominik.montada at arm.com>
Date: Wed, 1 Apr 2026 17:22:18 +0200
Subject: [PATCH] [llvm-reduce] Set the target triple before parsing machine
functions
Make sure that the module has a target triple set before trying to parse
machine functions. This can be required for (downstream) targets if
MIR parsing relies on features guarded by the target triple.
---
llvm/tools/llvm-reduce/ReducerWorkItem.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
index c479233a712e7..b7e8118ea73a2 100644
--- a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
+++ b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
@@ -859,6 +859,9 @@ llvm::parseReducerWorkItem(StringRef ToolName, StringRef Filename,
std::unique_ptr<Module> M = MParser->parseIRModule(SetDataLayout);
+ if (!TheTriple.empty())
+ M->setTargetTriple(TheTriple);
+
MMM->MMI = std::make_unique<MachineModuleInfo>(TM.get());
MParser->parseMachineFunctions(*M, *MMM->MMI);
MMM->M = std::move(M);
More information about the llvm-commits
mailing list