mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #82798 from eeckstein/fix-let-property-lowering
LetPropertyLowering: remove redundant phis after ssa-update
This commit is contained in:
@@ -371,6 +371,8 @@ struct BridgedPassContext {
|
||||
BRIDGED_INLINE void SSAUpdater_addAvailableValue(BridgedBasicBlock block, BridgedValue value) const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedValue SSAUpdater_getValueAtEndOfBlock(BridgedBasicBlock block) const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedValue SSAUpdater_getValueInMiddleOfBlock(BridgedBasicBlock block) const;
|
||||
BRIDGED_INLINE SwiftInt SSAUpdater_getNumInsertedPhis() const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedValue SSAUpdater_getInsertedPhi(SwiftInt idx) const;
|
||||
|
||||
// Options
|
||||
|
||||
|
||||
@@ -555,6 +555,14 @@ BridgedValue BridgedPassContext::SSAUpdater_getValueInMiddleOfBlock(BridgedBasic
|
||||
invocation->getSSAUpdater()->getValueInMiddleOfBlock(block.unbridged())};
|
||||
}
|
||||
|
||||
SwiftInt BridgedPassContext::SSAUpdater_getNumInsertedPhis() const {
|
||||
return (SwiftInt)invocation->getInsertedPhisBySSAUpdater().size();
|
||||
}
|
||||
|
||||
BridgedValue BridgedPassContext::SSAUpdater_getInsertedPhi(SwiftInt idx) const {
|
||||
return {invocation->getInsertedPhisBySSAUpdater()[idx]};
|
||||
}
|
||||
|
||||
bool BridgedPassContext::enableStackProtection() const {
|
||||
swift::SILModule *mod = invocation->getPassManager()->getModule();
|
||||
return mod->getOptions().EnableStackProtection;
|
||||
|
||||
@@ -75,6 +75,7 @@ class SwiftPassInvocation {
|
||||
SILModule::SlabList allocatedSlabs;
|
||||
|
||||
SILSSAUpdater *ssaUpdater = nullptr;
|
||||
SmallVector<SILPhiArgument *, 4> insertedPhisBySSAUpdater;
|
||||
|
||||
SwiftPassInvocation *nestedSwiftPassInvocation = nullptr;
|
||||
|
||||
@@ -178,8 +179,9 @@ public:
|
||||
|
||||
void initializeSSAUpdater(SILFunction *fn, SILType type,
|
||||
ValueOwnershipKind ownership) {
|
||||
insertedPhisBySSAUpdater.clear();
|
||||
if (!ssaUpdater)
|
||||
ssaUpdater = new SILSSAUpdater;
|
||||
ssaUpdater = new SILSSAUpdater(&insertedPhisBySSAUpdater);
|
||||
ssaUpdater->initialize(fn, type, ownership);
|
||||
}
|
||||
|
||||
@@ -188,6 +190,8 @@ public:
|
||||
return ssaUpdater;
|
||||
}
|
||||
|
||||
ArrayRef<SILPhiArgument *> getInsertedPhisBySSAUpdater() { return insertedPhisBySSAUpdater; }
|
||||
|
||||
SwiftPassInvocation *initializeNestedSwiftPassInvocation(SILFunction *newFunction) {
|
||||
assert(!nestedSwiftPassInvocation && "Nested Swift pass invocation already initialized");
|
||||
nestedSwiftPassInvocation = new SwiftPassInvocation(passManager, transform, newFunction);
|
||||
|
||||
Reference in New Issue
Block a user