!8105 Fix fuzz bug

Merge pull request !8105 from yycc/fuzzbug
This commit is contained in:
openharmony_ci 2024-07-18 03:21:17 +00:00 committed by Gitee
commit a48476a296
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 14 additions and 4 deletions

View File

@ -112,6 +112,14 @@ void CombinedPassVisitor::VisitGraph()
for (auto useIt = uses.begin(); useIt != uses.end(); useIt++) {
PushChangedGate(*useIt);
}
std::vector<GateRef> gateList;
circuit_->GetAllGates(gateList);
for (auto gate : gateList) {
if (acc_.GetOpCode(gate) == OpCode::LOOP_BEGIN) {
PushChangedGate(gate);
}
}
while (true) {
if (!workList_.empty()) {
Edge& current = workList_.back();

View File

@ -498,13 +498,13 @@ TypeInfo NumberSpeculativeRetype::GetOuputForPhi(GateRef gate, bool ignoreConsta
for (size_t i = 0; i < valueNum; ++i) {
GateRef input = acc_.GetValueIn(gate, i);
TypeInfo inputInfo = GetOutputTypeInfo(input);
if (inputInfo == TypeInfo::NONE) {
continue;
}
if (ignoreConstant && acc_.IsConstantNumber(input)) {
hasConstantInput = true;
continue;
}
if (inputInfo == TypeInfo::NONE) {
continue;
}
// use less general input as phi output
if (tempType == TypeInfo::NONE) {
tempType = inputInfo;
@ -1570,8 +1570,10 @@ GateRef NumberSpeculativeRetype::VisitTypeConvert(GateRef gate)
if (IsRetype()) {
if (inputInfo == TypeInfo::TAGGED) {
if (acc_.IsConstantNumber(input)) {
TypeInfo oldType = GetOutputTypeInfo(gate);
acc_.SetGateType(gate, acc_.GetGateType(input));
return Circuit::NullGate();
SetOutputTypeInfo(gate, inputInfo);
return oldType == inputInfo ? Circuit::NullGate() : gate;
}
ASSERT(paramType.HasNumberType());
return SetOutputType(gate, paramType);