[llvm-reduce] Set the target triple before parsing machine functions (#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.
This commit is contained in:
parent
fdc54c9a1e
commit
f7b6cc1efa
16
llvm/test/tools/llvm-reduce/mir/set-triple-on-module.mir
Normal file
16
llvm/test/tools/llvm-reduce/mir/set-triple-on-module.mir
Normal file
@ -0,0 +1,16 @@
|
||||
# REQUIRES: x86-registered-target
|
||||
|
||||
# RUN: llvm-reduce -simplify-mir -mtriple="x86_64-unknown-linux-gnu" --test FileCheck --test-arg --check-prefix=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
|
||||
# RUN: FileCheck %s < %t
|
||||
|
||||
# CHECK-INTERESTINGNESS: RET64
|
||||
|
||||
# CHECK: target triple = "x86_64-unknown-linux-gnu"
|
||||
# CHECK: name: func
|
||||
|
||||
---
|
||||
name: func
|
||||
body: |
|
||||
bb.0:
|
||||
RET64
|
||||
...
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user