mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SimplifyCFG: fix crash if a branch argument is replaced with a SILValue with result number != 0
Fixes https://bugs.swift.org/browse/SR-329 rdar://problem/23969954
This commit is contained in:
@@ -966,7 +966,7 @@ bool SimplifyCFG::simplifyBranchOperands(OperandValueArrayRef Operands) {
|
||||
for (auto O = Operands.begin(), E = Operands.end(); O != E; ++O)
|
||||
if (auto *I = dyn_cast<SILInstruction>(*O))
|
||||
if (SILValue Result = simplifyInstruction(I)) {
|
||||
SILValue(I, 0).replaceAllUsesWith(Result.getDef());
|
||||
SILValue(I, 0).replaceAllUsesWith(Result);
|
||||
if (isInstructionTriviallyDead(I)) {
|
||||
eraseFromParentWithDebugInsts(I);
|
||||
Simplified = true;
|
||||
|
||||
Reference in New Issue
Block a user