Skip to content

[MIR] Dataflow framework, constant propagation and dead code elimination #35608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 24 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
64afc5e
Make BitVec::contains panic-less
nagisa Aug 2, 2016
5fdc839
Expand BitVec functionality slightly
nagisa Aug 2, 2016
34d0545
[MIR] Utility to retrieve base variable of Lvalue
nagisa Aug 2, 2016
ccdc81a
Add a MIR dataflow framework (again)
nagisa Aug 5, 2016
8b8ccf0
[MIR] Constant propagation
nagisa Aug 6, 2016
ba6a8fb
Count time taken by MIR passes
nagisa Aug 6, 2016
2cc114c
Count and report time taken by MIR passes
nagisa Aug 7, 2016
d203b9c
Comments, todos and small improvements
nagisa Aug 7, 2016
18f65dd
Add Rvalue::is_pure
nagisa Aug 7, 2016
97bfde3
Fix compilation
nagisa Aug 9, 2016
61a58f1
Fix join function for CsLattice
nagisa Aug 11, 2016
efbea54
Rename dead code removal pass to a proper-er name
nagisa Aug 11, 2016
b15bb6d
Add some constant propagation tests
nagisa Aug 11, 2016
f78274c
Clean-up the ConstLattice; Propagate global state
nagisa Aug 15, 2016
61871d4
Re-add a way to specify initial state
nagisa Aug 15, 2016
1b3e945
Rebase fallout
nagisa Aug 15, 2016
935dc8d
Make SwitchInt switch on Operand
nagisa Aug 15, 2016
3e2e8b9
Disallow to optimise out constants in OOB tests
nagisa Aug 15, 2016
e00862b
A way to remove otherwise unused locals from MIR
nagisa Aug 16, 2016
c352ae2
Do not run the DA+ConstProp before DropElab
nagisa Aug 16, 2016
708487b
Rebase fallout
nagisa Aug 16, 2016
0791d56
Do not be overly aggressive optimising MIR with -g
nagisa Aug 18, 2016
9b227dd
More bitvec tests
nagisa Aug 18, 2016
ec8e500
Fix aliasing in const-propagate
nagisa Aug 19, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Make BitVec::contains panic-less
  • Loading branch information
nagisa committed Aug 18, 2016
commit 64afc5e68fd13f85f4a57a7b278559393fcc068e
2 changes: 1 addition & 1 deletion src/librustc_data_structures/bitvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl BitVector {

pub fn contains(&self, bit: usize) -> bool {
let (word, mask) = word_mask(bit);
(self.data[word] & mask) != 0
(self.data.get(word).cloned().unwrap_or(0) & mask) != 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that asking for an index that doesn't exist should panic and that this might mask bugs in other code. Do you use this behavior in your analysis?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that asking for an index that doesn't exist should panic and that this might mask bugs in other code.

It had such a behaviour for sizes which are not 0 mod 64 up to next 0 mod 64 bit already. This makes the behaviour consistent for all sizes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you use this behavior in your analysis?

I didn’t answer this: yes, I do. The dead code removing pass uses this behaviour.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see now. Yes it should be consistent at least :)

On Aug 11, 2016, at 4:14 PM, Simonas Kazlauskas notifications@github.com wrote:

In src/librustc_data_structures/bitvec.rs #35608 (comment):

 pub fn new(num_bits: usize) -> BitVector {
     let num_words = u64s(num_bits);
     BitVector { data: vec![0; num_words] }
 }

 pub fn contains(&self, bit: usize) -> bool {
     let (word, mask) = word_mask(bit);
  •    (self.data[word] & mask) != 0
    
  •    (self.data.get(word).cloned().unwrap_or(0) & mask) != 0
    
    It seems to me that asking for an index that doesn't exist should panic and that this might mask bugs in other code.

It had such a behaviour for sizes which are not 0 mod 64 up to next 0 mod 64 bit already. This makes the behaviour consistent for all sizes.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust/pull/35608/files/0962575160c619b29df676c0fbb0cee3f804caf7#r74520803, or mute the thread https://github.com/notifications/unsubscribe-auth/AAc1nWMtSQhjePDC7v--c3TRfwBd_6YFks5qe6zdgaJpZM4Jinmf.

}

/// Returns true if the bit has changed.
Expand Down