Skip to content
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

Assert if we find undefined use during interval validation #56439

Merged
merged 2 commits into from
Jul 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/coreclr/jit/lsrabuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2668,7 +2668,8 @@ void LinearScan::validateIntervals()
}
Interval* interval = getIntervalForLocalVar(i);

bool defined = false;
bool defined = false;
unsigned lastUseBBNum = 0;
JITDUMP("-----------------\n");
for (RefPosition* ref = interval->firstRefPosition; ref != nullptr; ref = ref->nextRefPosition)
{
Expand All @@ -2677,13 +2678,17 @@ void LinearScan::validateIntervals()
ref->dump(this);
}
RefType refType = ref->refType;
if (!defined && RefTypeIsUse(refType))
if (!defined && RefTypeIsUse(refType) && (lastUseBBNum == ref->bbNum))
{
if (compiler->info.compMethodName != nullptr)
if (!ref->lastUse)
{
JITDUMP("%s: ", compiler->info.compMethodName);
if (compiler->info.compMethodName != nullptr)
{
JITDUMP("%s: ", compiler->info.compMethodName);
}
JITDUMP("LocalVar V%02u: undefined use at %u\n", interval->varNum, ref->nodeLocation);
assert(false);
}
JITDUMP("LocalVar V%02u: undefined use at %u\n", interval->varNum, ref->nodeLocation);
}

// For single-def intervals, the only the first refposition should be a RefTypeDef
Expand All @@ -2696,7 +2701,8 @@ void LinearScan::validateIntervals()
// so we can't really check the lastUse flag
if (ref->lastUse)
{
defined = false;
defined = false;
lastUseBBNum = ref->bbNum;
}
if (RefTypeIsDef(refType))
{
Expand Down