mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Update Devirtualizer's analysis invalidation (#31284)
* Update Devirtualizer's analysis invalidation castValueToABICompatibleType can change CFG, Devirtualizer uses this api but doesn't check if it modified the cfg
This commit is contained in:
@@ -2418,9 +2418,9 @@ bool SimplifyCFG::simplifyTryApplyBlock(TryApplyInst *TAI) {
|
||||
for (unsigned i = 0; i < numArgs; ++i) {
|
||||
auto Arg = TAI->getArgument(i);
|
||||
// Cast argument if required.
|
||||
Arg = castValueToABICompatibleType(&Builder, TAI->getLoc(), Arg,
|
||||
origConv.getSILArgumentType(i),
|
||||
targetConv.getSILArgumentType(i));
|
||||
std::tie(Arg, std::ignore) = castValueToABICompatibleType(
|
||||
&Builder, TAI->getLoc(), Arg, origConv.getSILArgumentType(i),
|
||||
targetConv.getSILArgumentType(i));
|
||||
Args.push_back(Arg);
|
||||
}
|
||||
|
||||
@@ -2435,8 +2435,9 @@ bool SimplifyCFG::simplifyTryApplyBlock(TryApplyInst *TAI) {
|
||||
auto Loc = TAI->getLoc();
|
||||
auto *NormalBB = TAI->getNormalBB();
|
||||
|
||||
auto CastedResult = castValueToABICompatibleType(&Builder, Loc, NewAI,
|
||||
ResultTy, OrigResultTy);
|
||||
SILValue CastedResult;
|
||||
std::tie(CastedResult, std::ignore) = castValueToABICompatibleType(
|
||||
&Builder, Loc, NewAI, ResultTy, OrigResultTy);
|
||||
|
||||
Builder.createBranch(Loc, NormalBB, { CastedResult });
|
||||
TAI->eraseFromParent();
|
||||
|
||||
Reference in New Issue
Block a user