From f106e4266ad91115df8abd1279adc48c6187c11c Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Wed, 6 Dec 2017 08:30:48 -0800 Subject: [PATCH] Enable the IL verifier by default. Change the default value for the "enable_verifier" setting so the verifier runs unless it is explicitly disabled. Most projects using Cretonne are best off running the verifier always until they start caring about compile time performance. Then they can easily disable the verifier. --- cranelift/src/compile.rs | 6 +----- lib/cretonne/meta/base/settings.py | 3 ++- lib/cretonne/src/settings.rs | 2 +- lib/reader/src/parser.rs | 9 +-------- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/cranelift/src/compile.rs b/cranelift/src/compile.rs index 9e828cfed2..ae0c87ad36 100644 --- a/cranelift/src/compile.rs +++ b/cranelift/src/compile.rs @@ -12,13 +12,9 @@ use utils::{pretty_error, read_to_string, parse_sets_and_isa}; pub fn run( files: Vec, flag_print: bool, - mut flag_set: Vec, + flag_set: Vec, flag_isa: String, ) -> Result<(), String> { - // Enable the verifier by default, since we're reading IL in from a - // text file. - flag_set.insert(0, "enable_verifier=1".to_string()); - let parsed = parse_sets_and_isa(flag_set, flag_isa)?; for filename in files { diff --git a/lib/cretonne/meta/base/settings.py b/lib/cretonne/meta/base/settings.py index 11f0728e11..a08d5b4c3f 100644 --- a/lib/cretonne/meta/base/settings.py +++ b/lib/cretonne/meta/base/settings.py @@ -24,7 +24,8 @@ enable_verifier = BoolSetting( This makes compilation slower but catches many bugs. The verifier is disabled by default, except when reading Cretonne IL from a text file. - """) + """, + default=True) is_64bit = BoolSetting("Enable 64-bit code generation") diff --git a/lib/cretonne/src/settings.rs b/lib/cretonne/src/settings.rs index d04dd4991f..4893ecf35a 100644 --- a/lib/cretonne/src/settings.rs +++ b/lib/cretonne/src/settings.rs @@ -345,7 +345,7 @@ mod tests { f.to_string(), "[shared]\n\ opt_level = \"default\"\n\ - enable_verifier = false\n\ + enable_verifier = true\n\ is_64bit = false\n\ return_at_end = false\n\ is_compressed = false\n\ diff --git a/lib/reader/src/parser.rs b/lib/reader/src/parser.rs index b3827de62c..ac25f1e6e6 100644 --- a/lib/reader/src/parser.rs +++ b/lib/reader/src/parser.rs @@ -14,7 +14,7 @@ use cretonne::ir::immediates::{Imm64, Uimm32, Offset32, Ieee32, Ieee64}; use cretonne::ir::entities::AnyEntity; use cretonne::ir::instructions::{InstructionFormat, InstructionData, VariableArgs}; use cretonne::isa::{self, TargetIsa, Encoding, RegUnit}; -use cretonne::settings::{self, Configurable}; +use cretonne::settings; use testfile::{TestFile, Details, Comment}; use error::{Location, Error, Result}; use lexer::{self, Lexer, Token}; @@ -731,13 +731,6 @@ impl<'a> Parser<'a> { let mut isas = Vec::new(); let mut flag_builder = settings::builder(); - // Change the default for `enable_verifier` to `true`. It defaults to `false` because it - // would slow down normal compilation, but when we're reading IL from a text file we're - // either testing or debugging Cretonne, and verification makes sense. - flag_builder.enable("enable_verifier").expect( - "Missing enable_verifier setting", - ); - while let Some(Token::Identifier(command)) = self.token() { match command { "set" => {