mirror of
https://github.com/golang/go
synced 2024-10-02 22:25:08 +00:00
fix broken dominance caught by ssacheck
See https://go-review.googlesource.com/c/go/+/483875 for more details. This happens when sccp generates a temporary Value v217 and it attempts to apply rewrite rule on it to see if v217 can be fold to constant value, v227 = Const64 <int32> v117 = Const32 <int32> [3] v217 = Mul32 <int32> v117 v227 In this case, v217 can not match any rules in generic rules, so it left in entry block while its arguments lives other blocks, which breaks the dominance relationship. These temporary values are dead values and will be removed in further deadcode phase but checkFunc catches them because it runs right after every pass. The proposed fix is to invalidate unmatched temporary value immediately.
This commit is contained in:
parent
e249f44ad6
commit
830016f24e
|
@ -358,8 +358,10 @@ func computeLattice(f *Func, val *Value, args ...*Value) lattice {
|
|||
return lattice{constant, constValue}
|
||||
}
|
||||
}
|
||||
// Either we can not match generic rules for given value or it does not satisfy
|
||||
// additional constraints(e.g. divide by zero)
|
||||
// Either we can not match generic rules for given value or it does not
|
||||
// satisfy additional constraints(e.g. divide by zero), in these cases, clean
|
||||
// up temporary value immediately in case they are not dominated by their args.
|
||||
constValue.reset(OpInvalid)
|
||||
return lattice{bottom, nil}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue