aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2017-01-13 23:46:11 +0000
committerJustin Bogner <mail@justinbogner.com>2017-01-13 23:46:11 +0000
commit1a314dac4b067ec2d9bf0a3e56c6b572871c69bf (patch)
tree4f28525f8f51e82955fd794157e70148dc2443f9 /llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
parentfaf2a81380e5ae97fcb420735cb66e978c943b27 (diff)
downloadllvm-1a314dac4b067ec2d9bf0a3e56c6b572871c69bf.zip
llvm-1a314dac4b067ec2d9bf0a3e56c6b572871c69bf.tar.gz
llvm-1a314dac4b067ec2d9bf0a3e56c6b572871c69bf.tar.bz2
GlobalISel: Abort in ResetMachineFunctionPass if fallback isn't enabled
When GlobalISel is configured to abort rather than fallback the only thing that resetting the machine function does is make things harder to debug. If we ever get to this point in the abort configuration it indicates that we've already hit a bug, so this changes the behaviour to abort instead. llvm-svn: 291977
Diffstat (limited to 'llvm/lib/CodeGen/ResetMachineFunctionPass.cpp')
-rw-r--r--llvm/lib/CodeGen/ResetMachineFunctionPass.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp b/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
index 4519641..3e25992 100644
--- a/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
+++ b/llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
@@ -30,17 +30,23 @@ namespace {
/// Tells whether or not this pass should emit a fallback
/// diagnostic when it resets a function.
bool EmitFallbackDiag;
+ /// Whether we should abort immediately instead of resetting the function.
+ bool AbortOnFailedISel;
public:
static char ID; // Pass identification, replacement for typeid
- ResetMachineFunction(bool EmitFallbackDiag = false)
- : MachineFunctionPass(ID), EmitFallbackDiag(EmitFallbackDiag) {}
+ ResetMachineFunction(bool EmitFallbackDiag = false,
+ bool AbortOnFailedISel = false)
+ : MachineFunctionPass(ID), EmitFallbackDiag(EmitFallbackDiag),
+ AbortOnFailedISel(AbortOnFailedISel) {}
StringRef getPassName() const override { return "ResetMachineFunction"; }
bool runOnMachineFunction(MachineFunction &MF) override {
if (MF.getProperties().hasProperty(
MachineFunctionProperties::Property::FailedISel)) {
+ if (AbortOnFailedISel)
+ report_fatal_error("Instruction selection failed");
DEBUG(dbgs() << "Reseting: " << MF.getName() << '\n');
++NumFunctionsReset;
MF.reset();
@@ -62,6 +68,7 @@ INITIALIZE_PASS(ResetMachineFunction, DEBUG_TYPE,
"reset machine function if ISel failed", false, false)
MachineFunctionPass *
-llvm::createResetMachineFunctionPass(bool EmitFallbackDiag = false) {
- return new ResetMachineFunction(EmitFallbackDiag);
+llvm::createResetMachineFunctionPass(bool EmitFallbackDiag = false,
+ bool AbortOnFailedISel = false) {
+ return new ResetMachineFunction(EmitFallbackDiag, AbortOnFailedISel);
}