-
Notifications
You must be signed in to change notification settings - Fork 262
analyze: run equiv pass before pointee #1173
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
Conversation
fn pointee_type(&self, ptr: PointerId) -> Option<LTy<'tcx>> { | ||
self.pointee_types | ||
.as_ref() | ||
.and_then(|pointee_types| pointee_types[ptr].get_sole_lty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this panic if ptr
is out of bounds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will panic if ptr
is PointerId::NONE
(the same is true of the code this is replacing). I added an assert just to make it clear that this should only be called on actual pointers: 7f1d501
74a6d31
to
955f20b
Compare
d4efb1a
to
7f1d501
Compare
This gives more useful panic locations when a `FuncInfo` field is accessed while unset.
955f20b
to
a0850b1
Compare
7f1d501
to
e1c17c4
Compare
e1c17c4
to
7013b6d
Compare
This branch changes the order of analysis passes to run the equivalence class analysis and
PointerId
renumbering before running the pointee type analysis. In particular, this improves the pointee results in cases involvingfresh
references, such as this new test case:Most of the changes here are refactorings to move specific analysis passes from
run()
into helper functions, which makes them easier to reorder.