mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #82798 from eeckstein/fix-let-property-lowering
LetPropertyLowering: remove redundant phis after ssa-update
This commit is contained in:
@@ -122,6 +122,8 @@ private func insertEndInitInstructions(
|
||||
use.set(to: ssaUpdater.getValue(atEndOf: use.instruction.parentBlock), context)
|
||||
}
|
||||
}
|
||||
// This peephole optimization is required to avoid ownership errors.
|
||||
replacePhisWithIncomingValues(phis: ssaUpdater.insertedPhis, context)
|
||||
}
|
||||
|
||||
private func constructLetInitRegion(
|
||||
|
||||
@@ -50,4 +50,14 @@ struct SSAUpdater<Context: MutatingContext> {
|
||||
context.notifyInstructionsChanged()
|
||||
return context._bridged.SSAUpdater_getValueInMiddleOfBlock(block.bridged).value
|
||||
}
|
||||
|
||||
var insertedPhis: [Phi] {
|
||||
var phis = [Phi]()
|
||||
let numPhis = context._bridged.SSAUpdater_getNumInsertedPhis()
|
||||
phis.reserveCapacity(numPhis)
|
||||
for idx in 0..<numPhis {
|
||||
phis.append(Phi(context._bridged.SSAUpdater_getInsertedPhi(idx).value)!)
|
||||
}
|
||||
return phis
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user