-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #120171 - cjgillot:jump-threading-assume-assert, r=tm…
…iasko Fix assume and assert in jump threading r? ``@tmiasko``
- Loading branch information
Showing
11 changed files
with
209 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/mir-opt/building/custom/assume.assume_constant.built.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// MIR for `assume_constant` after built | ||
|
||
fn assume_constant() -> () { | ||
let mut _0: (); | ||
|
||
bb0: { | ||
assume(const true); | ||
return; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/mir-opt/building/custom/assume.assume_local.built.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// MIR for `assume_local` after built | ||
|
||
fn assume_local(_1: bool) -> () { | ||
let mut _0: (); | ||
|
||
bb0: { | ||
assume(_1); | ||
return; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/mir-opt/building/custom/assume.assume_place.built.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// MIR for `assume_place` after built | ||
|
||
fn assume_place(_1: (bool, u8)) -> () { | ||
let mut _0: (); | ||
|
||
bb0: { | ||
assume((_1.0: bool)); | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// skip-filecheck | ||
#![feature(custom_mir, core_intrinsics)] | ||
|
||
extern crate core; | ||
use core::intrinsics::mir::*; | ||
|
||
// EMIT_MIR assume.assume_local.built.after.mir | ||
#[custom_mir(dialect = "built")] | ||
fn assume_local(x: bool) { | ||
mir!( | ||
{ | ||
Assume(x); | ||
Return() | ||
} | ||
) | ||
} | ||
|
||
// EMIT_MIR assume.assume_place.built.after.mir | ||
#[custom_mir(dialect = "built")] | ||
fn assume_place(p: (bool, u8)) { | ||
mir!( | ||
{ | ||
Assume(p.0); | ||
Return() | ||
} | ||
) | ||
} | ||
|
||
// EMIT_MIR assume.assume_constant.built.after.mir | ||
#[custom_mir(dialect = "built")] | ||
fn assume_constant() { | ||
mir!( | ||
{ | ||
Assume(true); | ||
Return() | ||
} | ||
) | ||
} | ||
|
||
fn main() { | ||
assume_local(true); | ||
assume_place((true, 50)); | ||
assume_constant(); | ||
} |
39 changes: 39 additions & 0 deletions
39
tests/mir-opt/jump_threading.assume.JumpThreading.panic-abort.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
- // MIR for `assume` before JumpThreading | ||
+ // MIR for `assume` after JumpThreading | ||
|
||
fn assume(_1: u8, _2: bool) -> u8 { | ||
let mut _0: u8; | ||
|
||
bb0: { | ||
switchInt(_1) -> [7: bb1, otherwise: bb2]; | ||
} | ||
|
||
bb1: { | ||
assume(_2); | ||
- goto -> bb3; | ||
+ goto -> bb6; | ||
} | ||
|
||
bb2: { | ||
goto -> bb3; | ||
} | ||
|
||
bb3: { | ||
switchInt(_2) -> [0: bb4, otherwise: bb5]; | ||
} | ||
|
||
bb4: { | ||
_0 = const 4_u8; | ||
return; | ||
} | ||
|
||
bb5: { | ||
_0 = const 5_u8; | ||
return; | ||
+ } | ||
+ | ||
+ bb6: { | ||
+ goto -> bb5; | ||
} | ||
} | ||
|
39 changes: 39 additions & 0 deletions
39
tests/mir-opt/jump_threading.assume.JumpThreading.panic-unwind.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
- // MIR for `assume` before JumpThreading | ||
+ // MIR for `assume` after JumpThreading | ||
|
||
fn assume(_1: u8, _2: bool) -> u8 { | ||
let mut _0: u8; | ||
|
||
bb0: { | ||
switchInt(_1) -> [7: bb1, otherwise: bb2]; | ||
} | ||
|
||
bb1: { | ||
assume(_2); | ||
- goto -> bb3; | ||
+ goto -> bb6; | ||
} | ||
|
||
bb2: { | ||
goto -> bb3; | ||
} | ||
|
||
bb3: { | ||
switchInt(_2) -> [0: bb4, otherwise: bb5]; | ||
} | ||
|
||
bb4: { | ||
_0 = const 4_u8; | ||
return; | ||
} | ||
|
||
bb5: { | ||
_0 = const 5_u8; | ||
return; | ||
+ } | ||
+ | ||
+ bb6: { | ||
+ goto -> bb5; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters