Browse Source
closes #2827 : remove srclocs from bugpoint (#8883 )
* closes #2827 : remove srclocs from bugpoint
* cranelift(fix): bugpoint only removes sourcelocs if function still crashes
* fix formatting
---------
Co-authored-by: zleyyij <zleyyij@users.noreply.github.com>
pull/8923/head
zleyyij
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
13 additions and
3 deletions
cranelift/src/bugpoint.rs
cranelift/tests/bugpoint_test.clif
@ -831,6 +831,15 @@ fn try_resolve_aliases(context: &mut CrashCheckContext, func: &mut Function) {
}
}
/// Remove sourcelocs if the function still crashes after they are removed, to make the reduced clif IR easier to read.
fn try_remove_srclocs ( context : & mut CrashCheckContext , func : & mut Function ) {
let mut func_with_removed_sourcelocs = func . clone ( ) ;
func_with_removed_sourcelocs . srclocs . clear ( ) ;
if let CheckResult ::Crash ( _ ) = context . check_for_crash ( & func_with_removed_sourcelocs ) {
* func = func_with_removed_sourcelocs ;
}
}
fn reduce ( isa : & dyn TargetIsa , mut func : Function , verbose : bool ) -> Result < ( Function , String ) > {
let mut context = CrashCheckContext ::new ( isa ) ;
@ -839,6 +848,7 @@ fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(Fun
}
try_resolve_aliases ( & mut context , & mut func ) ;
try_remove_srclocs ( & mut context , & mut func ) ;
let progress_bar = ProgressBar ::with_draw_target ( 0 , ProgressDrawTarget ::stdout ( ) ) ;
progress_bar . set_style (
@ -300,12 +300,12 @@ block0(v0: i64, v1: i64, v2: i64):
v241 -> v1
v256 -> v1
v262 -> v1
v3 = imul v0, v1
@0001 v3 = imul v0, v1
v4 = imul v1, v2
store aligned v4, v3
v5 = load.i64 aligned v2+8
store aligned v5, v3+8
v6 = stack_addr.i64 ss1
@0002 v6 = stack_addr.i64 ss1
v7 = stack_addr.i64 ss2
v8 = stack_addr.i64 ss3
v9 = stack_addr.i64 ss4
@ -366,7 +366,7 @@ block0(v0: i64, v1: i64, v2: i64):
v64 = stack_addr.i64 ss59
v65 = stack_addr.i64 ss60
v66 = stack_addr.i64 ss61
v67 = stack_addr.i64 ss62
@0003 v67 = stack_addr.i64 ss62
v68 = stack_addr.i64 ss63
v69 = stack_addr.i64 ss64
v70 = stack_addr.i64 ss65