forked from OSchip/llvm-project
[llc] Error out when -print-machineinstrs is used with an unknown pass
We used to assert instead of reporting an error. PR39494 llvm-svn: 345589
This commit is contained in:
parent
b3735ee14e
commit
85d3f1ee8f
|
@ -806,16 +806,18 @@ void TargetPassConfig::addMachinePasses() {
|
|||
AddingMachinePasses = true;
|
||||
|
||||
// Insert a machine instr printer pass after the specified pass.
|
||||
if (!StringRef(PrintMachineInstrs.getValue()).equals("") &&
|
||||
!StringRef(PrintMachineInstrs.getValue()).equals("option-unspecified")) {
|
||||
StringRef PrintMachineInstrsPassName = PrintMachineInstrs.getValue();
|
||||
if (!PrintMachineInstrsPassName.equals("") &&
|
||||
!PrintMachineInstrsPassName.equals("option-unspecified")) {
|
||||
if (const PassInfo *TPI = getPassInfo(PrintMachineInstrsPassName)) {
|
||||
const PassRegistry *PR = PassRegistry::getPassRegistry();
|
||||
const PassInfo *TPI = PR->getPassInfo(PrintMachineInstrs.getValue());
|
||||
const PassInfo *IPI = PR->getPassInfo(StringRef("machineinstr-printer"));
|
||||
assert (TPI && IPI && "Pass ID not registered!");
|
||||
assert(IPI && "failed to get \"machineinstr-printer\" PassInfo!");
|
||||
const char *TID = (const char *)(TPI->getTypeInfo());
|
||||
const char *IID = (const char *)(IPI->getTypeInfo());
|
||||
insertPass(TID, IID);
|
||||
}
|
||||
}
|
||||
|
||||
// Print the instruction selected machine code...
|
||||
printAndVerify("After Instruction Selection");
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# Check that -print-machineinstrs doesn't assert when it's passed an unknown pass name.
|
||||
# RUN: llc -mtriple=x86_64-- -start-before=greedy -print-machineinstrs=greedy %s -o /dev/null
|
||||
# RUN: not llc -mtriple=x86_64-- -start-before=greedy -print-machineinstrs=unknown %s -o /dev/null 2>&1 | FileCheck %s
|
||||
# CHECK: LLVM ERROR: "unknown" pass is not registered.
|
||||
|
||||
...
|
||||
---
|
||||
name: fun
|
||||
tracksRegLiveness: true
|
||||
body: |
|
||||
bb.0:
|
||||
RET 0
|
Loading…
Reference in New Issue