Skip to content

Commit

Permalink
Use successor location for dominator check.
Browse files Browse the repository at this point in the history
The assignment is complete only after the statement.
This marks self-assignments `x = x + 1` as non-sSA.
  • Loading branch information
cjgillot committed Jan 27, 2023
1 parent d29dc05 commit 263da25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/ssa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor {
Set1::Empty | Set1::Many => false,
Set1::One(LocationExtended::Arg) => true,
Set1::One(LocationExtended::Plain(assign)) => {
assign.dominates(loc, &self.dominators)
assign.successor_within_block().dominates(loc, &self.dominators)
}
};
// We are visiting a use that is not dominated by an assignment.
Expand Down

0 comments on commit 263da25

Please sign in to comment.