Fix miscompile in SimplifyBranchSame

This commit is contained in:
Simon Vandel Sillesen 2020-10-04 00:00:00 +00:00 committed by Tomasz Miąsko
parent 4ccf5f731b
commit 80d5017a6e

View File

@ -630,7 +630,8 @@ fn find(&self) -> Vec<SimplifyBranchSameOptimization> {
// All successor basic blocks must be equal or contain statements that are pairwise considered equal.
for ((target_and_value_l,bb_l), (target_and_value_r,bb_r)) in iter_bbs_reachable.tuple_windows() {
let trivial_checks = bb_l.is_cleanup == bb_r.is_cleanup
&& bb_l.terminator().kind == bb_r.terminator().kind;
&& bb_l.terminator().kind == bb_r.terminator().kind
&& bb_l.statements.len() == bb_r.statements.len();
let statement_check = || {
bb_l.statements.iter().zip(&bb_r.statements).try_fold(StatementEquality::TrivialEqual, |acc,(l,r)| {
let stmt_equality = self.statement_equality(*adt_matched_on, &l, target_and_value_l, &r, target_and_value_r);