mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SILOptimizer] Fix a bug in edge-splitting wherein we did not create a new phi argument for blocks
Exposed in stack promotion / when doing stack nesting rdar://problem/48603037
This commit is contained in:
@@ -50,8 +50,10 @@ void swift::changeBranchTarget(TermInst *T, unsigned edgeIdx,
|
||||
case TermKind::BranchInst: {
|
||||
auto *BI = cast<BranchInst>(T);
|
||||
SmallVector<SILValue, 8> args;
|
||||
for (auto arg : BI->getArgs())
|
||||
args.push_back(arg);
|
||||
if (preserveArgs) {
|
||||
for (auto arg : BI->getArgs())
|
||||
args.push_back(arg);
|
||||
}
|
||||
B.createBranch(T->getLoc(), newDest, args);
|
||||
BI->dropAllReferences();
|
||||
BI->eraseFromParent();
|
||||
|
||||
Reference in New Issue
Block a user