swift-ci
517a78cc12
Merge remote-tracking branch 'origin/main' into rebranch
2023-02-15 13:33:22 -08:00
eeckstein
04be498a47
Merge pull request #63686 from eeckstein/effects-refactoring
...
some refactoring in Effects and ComputeEscapeEffects
2023-02-15 22:20:51 +01:00
Erik Eckstein
40ed0fb388
Swift Optimizer: fix a crash when simplifying same-metatype comparisons of function types
...
The instance type of a metatype instruction is not necessarily a legal lowered SIL Type.
Lower the type before converting it to a SILType.
rdar://105502403
2023-02-15 21:14:32 +01:00
swift-ci
969a797b1d
Merge remote-tracking branch 'origin/main' into rebranch
2023-02-15 12:14:18 -08:00
Erik Eckstein
490c8fa1c2
ComputeEscapeEffects: some refactoring
...
Mostly source-code restructuring to make the source easier to read.
NFC
2023-02-15 18:42:38 +01:00
Erik Eckstein
8984046972
Effects: remove the isExclusive flag from the escapingToArgument effect
...
An argument-to-argument escape always involves a store, which makes an exclusive escape impossible.
2023-02-15 18:17:32 +01:00
Erik Eckstein
7a3ae09cfc
Effects: add some comments and add enum argument labels
...
For clarity
2023-02-15 18:17:32 +01:00
Erik Eckstein
49e66c57b8
StackProtection: ignore pointers with no stores
...
Stack protection only protects against overflows, but not against out of bounds reads.
rdar://105231457
2023-02-15 08:20:48 +01:00
swift-ci
639761b2a6
Merge remote-tracking branch 'origin/main' into rebranch
2023-02-13 12:53:28 -08:00
Erik Eckstein
7597641104
EscapeUtils: fix handling a raw pointer during up-walk
...
When walking up we shouldn't end up at a load where followLoads is false, because going from a (non-followLoads) address to a load always involves a class indirection.
There is one exception: loading a raw pointer
2023-02-13 16:16:06 +01:00
Erik Eckstein
d602836a26
EscapeUtils: consider that a begin_apply can yield it's indirect arguments
...
This is the only apply instruction where address arguments actually can "escape"
2023-02-13 16:16:05 +01:00
Erik Eckstein
113e23df03
ComputeEscapeEffects: correctly handle "exclusive" argument -> return effects
...
* Disallow stores in the return -> argument path. When walking up in the EscapeUtils, it's allowed to follow stores. Therefore stores wouldn't be handled correctly.
* Also make sure that there is a return -> argument path at all
Fixes a wrong address-escaping effect in case the called function copies an indirect argument to a newly created object.
rdar://105133434
2023-02-13 16:10:17 +01:00
Erik Eckstein
caea41a4e0
ComputeEscapeEffects: don't support exclusive argument -> argument effects.
...
Exclusive argument -> argument effects cannot appear because such an effect would involve a store which is not permitted for exclusive escapes.
2023-02-13 16:10:17 +01:00
swift-ci
53f371675b
Merge remote-tracking branch 'origin/main' into rebranch
2023-02-12 02:33:46 -08:00
Erik Eckstein
dfde580872
Effects: bail if effects are requested for not supported projection paths
...
Effects are only defined for operations which don't involve a load.
In case the argument's path involves a load we need to return the global effects.
2023-02-11 08:55:20 +01:00
Erik Eckstein
6226d56a52
SmallProjectionPath: add mayHaveTwoClassProjections
2023-02-11 08:55:20 +01:00
Erik Eckstein
8daa54a8c5
SmallProjectionPath: replace hasNoClassProjection with mayHaveClassProjection
...
It's less confusing.
NFC
2023-02-11 08:55:20 +01:00
Erik Eckstein
cc60815bfe
ComputeSideEffects: fix wrong side effect computation of releases/destroys
...
Only global side effects of the destructor were considered, but side effects weren't attributed to the released value.
rdar://105237110
2023-02-11 08:55:20 +01:00
swift-ci
962e99f385
Merge remote-tracking branch 'origin/main' into rebranch
2023-02-09 01:13:59 -08:00
Erik Eckstein
85210a4e91
Swift Optimizer: make some SILCombine optimizations available for the "Simplification" pass
...
* begin_cow_mutation
* global_value
* strong_retain and strong_release
So far, those simplifications did only run in SILCombine. Now they are also considered in the swift Simplification pass.
2023-02-09 06:50:05 +01:00
Erik Eckstein
1c70060e01
Swift Optimizer: add Onone simplification of struct_extract instructions
2023-02-09 06:50:05 +01:00
Erik Eckstein
20edeb6a8c
Swift Optimizer: add Onone simplification of unchecked_enum_data instructions
2023-02-09 06:50:05 +01:00
Erik Eckstein
4cf62696b6
Swift Optimizer: add Onone simplification of cond_br instructions
2023-02-09 06:50:05 +01:00
Erik Eckstein
d56ed65718
Swift Optimizer: add Onone simplification of some builtin instructions
...
* `Builtin.isConcrete`
* `Builtin.is_same_metatype`
2023-02-09 06:50:05 +01:00
Erik Eckstein
3f35a1d869
Swift Optimizer: add Onone simplification of branch instructions
2023-02-09 06:50:05 +01:00
Erik Eckstein
f1c6ed681d
Swift Optimizer: add Onone simplification of apply instructions
2023-02-09 06:50:05 +01:00
Erik Eckstein
7eb2cb82e4
Swift Optimizer: add a pass to cleanup debug_step instructions
...
If a `debug_step` has the same debug location as a previous or succeeding instruction it is removed.
It's just important that there is at least one instruction for a certain debug location so that single stepping on that location will work.
2023-02-09 06:50:05 +01:00
Erik Eckstein
cef6ef9a84
SIL: add a debug_step instruction
...
This instruction can be inserted by Onone optimizations as a replacement for deleted instructions to
ensure that it's possible to single step on its location.
2023-02-09 06:50:05 +01:00
Erik Eckstein
e92f27c01a
Swift SIL: add some APIs to Location
...
* `hasValidLineNumber`
* `isAutoGenerated`
* `isDebugSteppable`
2023-02-09 06:50:05 +01:00
Erik Eckstein
67ed6cfff8
Swift Optimizer: add Simplification passes
...
Those passes are a framework for instruction simplifications (which are not yet included in this commit).
Comparable to SILCombine
2023-02-09 06:49:58 +01:00
Erik Eckstein
1c1d17e18b
Swift Optimizer: add some small optimization utilities
...
* `Instruction.isTriviallyDead` and `Instruction.isTriviallyDeadIgnoringDebugUses`
* `Instruction.hasSameDebugLocationAsPreviousOrNextInstruction`
* `UseList.singleNonDebugUse`
* `UseList.isEmptyIgnoringDebugUses`
* `removeDeadBlocks`
* `FunctionPassContext.removeTriviallyDeadInstructionsPreservingDebugInfo` and `FunctionPassContext.removeTriviallyDeadInstructionsIgnoringDebugUses`
* `BasicBlock.dropAllReferences`
* `SimplifyContext.tryReplaceRedundantInstructionPair`
2023-02-09 06:49:58 +01:00
Erik Eckstein
b1c6ae60cd
Swift SIL: add metatype APIs to Type
...
* `var isMetatype: Bool`
* `var instanceTypeOfMetatype: Type`
2023-02-09 06:49:58 +01:00
Erik Eckstein
713f6c3946
Swift SIL: add Type.nominal and Type.isOrContainsObjectiveCClass APIs
2023-02-09 06:49:58 +01:00
Erik Eckstein
ae9e3a4976
Swift SIL: fix base class of MarkUninitializedInst
2023-02-09 06:49:58 +01:00
swift-ci
0e3d53284f
Merge remote-tracking branch 'origin/main' into rebranch
2023-02-06 09:53:17 -08:00
Anthony Latsis
a8c5f45da5
[docs] Suggest ninja bin/swift-frontend instead of ninja swift-frontend
...
...to cope with a bootstrapping quirk on arm64 Macs.
2023-02-06 13:09:28 +03:00
swift-ci
58a514b85b
Merge remote-tracking branch 'origin/main' into rebranch
2023-01-26 18:34:13 -08:00
Nate Chandler
6caa5048d0
[WalkUtils] Walk through move_value instructions.
...
Addresses the following regressions
StackPromo 10100 14400 +42.6% **0.70x**
seen when enabling lexical lifetimes in the standard library.
2023-01-25 11:39:42 -08:00
swift-ci
36818939bd
Merge remote-tracking branch 'origin/main' into rebranch
2023-01-20 12:35:04 -08:00
Erik Eckstein
b5e731dde2
WalkUtils: fix a crash when visiting mismatching types
...
The path components may not be related to the current value in case mismatching types are visited, e.g. different concrete types of an existential.
This can lead to mismatching operand numbers for struct and tuple instructions.
rdar://104435056
2023-01-20 15:06:48 +01:00
swift-ci
8889105f8f
Merge remote-tracking branch 'origin/main' into rebranch
2023-01-16 22:13:52 -08:00
Erik Eckstein
d96ef3bedd
Swift SIL: add some APIs to Location
...
* `var description`
* `func ==`
* `func hasSameSourceLocation(as:)`
2023-01-16 19:00:09 +01:00
Erik Eckstein
8d90dafb22
Swift SIL: add Function.reversedInstructions
2023-01-16 19:00:09 +01:00
Erik Eckstein
3645becada
PassManager: infrastructure to disable or enable a specific instruction simplification
...
* for testing: add the option `-simplify-instruction=<instruction-name>` to only run simplification passes for that instruction type
* on the swift side, add `Options.enableSimplification`
2023-01-16 19:00:09 +01:00
Erik Eckstein
72d3f8e3ff
Swift SIL: add SubstitutionMap.isEmpty
2023-01-16 19:00:09 +01:00
Erik Eckstein
3f457eb1d4
Swift SIL: add IntegerLiteralInst.value
2023-01-16 19:00:09 +01:00
Erik Eckstein
ee80da2e59
Swift SIL: fix the CondBranch instruction
...
* make its properties public
* fix the range construction in `trueOperands`
2023-01-16 19:00:09 +01:00
Erik Eckstein
d2bdec9f59
Swift SIL: add MarkUninitializedInst and MetatypeInst instructions
2023-01-16 19:00:09 +01:00
Erik Eckstein
221a16ba17
Swift SIL: add more arguments to Builder.createApply
...
add the `isNonThrowing` and `isNonAsync` flags and the `specializationInfo`
2023-01-16 19:00:09 +01:00
Erik Eckstein
cf8c68c6c4
Swift SIL: add Type.hasArchetype
2023-01-16 19:00:09 +01:00