Skip to content

[6.2] Fix assertion failure when performing constant-evaluation through basic blocks with non-constant arguments #80959

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

Merged
merged 1 commit into from
Apr 22, 2025
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
4 changes: 2 additions & 2 deletions lib/SILOptimizer/Utils/ConstExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1785,8 +1785,8 @@ ConstExprFunctionState::evaluateInstructionAndGetNext(
// Set up basic block arguments.
for (unsigned i = 0, e = br->getNumArgs(); i != e; ++i) {
auto argument = getConstantValue(br->getArg(i));
if (!argument.isConstant())
return {std::nullopt, argument};
// Do not fail if an argument is not constant because we still know enough to know what the next instruction will be.
// Failure may occur later, however, if/when this unknown argument value is used by an instruction in the target basic block.
setValue(destBB->getArgument(i), argument);
}
// Set the instruction pointer to the first instruction of the block.
Expand Down