Erik Eckstein
e95c6425f2
Swift SIL: add some APIs for global variables
2023-05-08 21:23:36 +02:00
Erik Eckstein
9b51e69dac
Swift Optimizer: constant fold builtins in the simplification passes
2023-05-08 21:23:36 +02:00
Erik Eckstein
8a8a895239
alias analysis: compute more precise memory effects of builtin "once"
...
* Check if the address in question is even visible from outside the function
* Return the memory effects of the called function
Also, add a new API `Instruction.memoryEffects`, which is internally used by `mayReadFromMemory` et al.
2023-05-08 21:23:36 +02:00
Erik Eckstein
5992e68d23
EscapeUtils: better handling of noescape closures and convert_function instructions
...
* Assume that a noescape closure argument cannot escape a called function
* Handle convert_function instructions
rdar://108837480
2023-05-03 19:53:19 +02:00
Erik Eckstein
7d70a70acf
SIL: add the drop_deinit instruction
...
his instruction is a marker for a following destroy instruction to suppress the call of the move-only type's deinitializer.
2023-04-11 10:25:48 +02:00
Slava Pestov
e24cbbc42f
SILOptimizer: Bridge new Pack_Inout, Pack_Owned, Pack_Guaranteed ownership kinds
2023-03-30 14:10:27 -04:00
Erik Eckstein
010efc1ca6
Swift Bridging: use C++ instead of C bridging for the optimizer
2023-03-21 15:33:09 +01:00
Erik Eckstein
04c90166c4
Swift Bridging: use C++ instead of C bridging for BridgedBuilder
2023-03-21 15:33:09 +01:00
Erik Eckstein
b4510105a6
Swift Bridging: remove BridgedNode
2023-03-21 15:33:09 +01:00
Erik Eckstein
7905a9ac64
Swift Bridging: remove C bridging functions for SILDebugLocation
2023-03-21 15:33:09 +01:00
Erik Eckstein
82d9da5981
Swift Bridging: use C++ instead of C bridging for BridgedMultiValueResult
2023-03-21 15:33:09 +01:00
Erik Eckstein
47ac2d2818
Swift Bridging: use C++ instead of C bridging for BridgedArgument
2023-03-21 15:33:09 +01:00
Erik Eckstein
7789b4063e
Swift Bridging: remove BridgedMemoryBehavior and use swift.MemoryBehavior instead
2023-03-21 15:33:09 +01:00
Erik Eckstein
4445373808
Swift Bridging: use C++ instead of C bridging for BridgedInstruction
2023-03-21 15:33:09 +01:00
Erik Eckstein
c4f5bab5b7
Swift Bridging: use C++ instead of C bridging for BridgedBasicBlock
2023-03-21 15:33:09 +01:00
Erik Eckstein
c0c0b80c81
Swift Bridging: use C++ instead of C bridging for BridgedGlobalVar
2023-03-21 15:33:09 +01:00
Erik Eckstein
ae7770d911
Swift Bridging: use C++ instead of C bridging for BridgedFunction
2023-03-21 15:33:09 +01:00
Erik Eckstein
e469c16744
Swift Bridging: remove BridgedType and directly use the C++ SILType instead
2023-03-21 15:33:09 +01:00
Erik Eckstein
598644fb92
Swift Bridging: use C++ instead of C bridging for the bridged witness table classes
2023-03-21 15:33:09 +01:00
Erik Eckstein
151f09769f
Swift Bridging: use C++ instead of C bridging for BridgedVTable and BridgedVTableEntry
2023-03-21 15:33:09 +01:00
Erik Eckstein
fc2ad09d4b
Swift Bridging: use C++ instead of C bridging for BridgedSuccessor
2023-03-21 15:33:09 +01:00
Erik Eckstein
eecea088e7
Swift Bridging: use C++ instead of C bridging for BridgedOperand and BridgedValue
2023-03-21 15:33:09 +01:00
Michael Gottesman
4a309575d7
[sil] Rename [moved] flag on debug_value/alloc_stack to moveable_value_debuginfo.
...
This is in preparation for wiring up debug info support for noncopyable
values. Originally this flag name made sense since it was set when we performed
consume operator checking. Now I am going to use it for noncopyable types as
well. I think the new name uses_moveable_value_debuginfo actually describes what
the flag is supposed to do, tell IRGen that the value may be moved since it
needs to use moveable value debug info emission.
2023-03-19 15:38:42 -07:00
Erik Eckstein
053a38d44b
Swift SIL: mark SIL object classes as immortal
...
This avoids ARC operations on those objects which improves compile time.
2023-03-14 21:07:03 +01:00
Erik Eckstein
318c30895f
Swift Optimizer: eliminate ARC operations on types which are marked as immortal
...
A type (mostly classes) can be attributed with `@_semantics("arc.immortal")`.
ARC operations on values of such types are eliminated.
This is useful for the bridged SIL objects in the swift compiler sources.
2023-03-14 21:07:03 +01:00
Erik Eckstein
3fca8cd06e
Swift SIL: speed up Operand.value
...
Instead of doing the type casts and/or conformance lookup on the swift side, do it on the C++ side.
It makes a significant performance difference because `Operand.value` is a time critical function
2023-03-14 21:07:03 +01:00
Erik Eckstein
f1095556c9
Swift SIL: let var UnaryInstruction.operand return an Operand and not a Value
...
To avoid confusion. Instead add specific getters for unary instructions with dedicated names.
NFC
2023-02-21 17:57:29 +01:00
eeckstein
40f05faf03
Merge pull request #63690 from eeckstein/fix-same-metatype-simplification
...
Swift Optimizer: fix a crash when simplifying same-metatype comparisons of function types
2023-02-16 06:45:00 +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
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
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
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
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
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
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
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
Erik Eckstein
230c93df30
SIL Optimizer: add some SIL modification APIs
...
* `MutatingContext.notifyInvalidatedStackNesting` and `MutatingContext.needFixStackNesting`
* `MutatingContext.tryDeleteDeadClosure`
* `MutatingContext.erase(block:)`
* `Undef.get`
* `BasicBlock.moveAllInstructions`
* `BasicBlock.eraseAllArguments`
* `BasicBlock.moveAllArguments`
* `TermInst.replaceBranchTarget`
2023-01-16 19:00:09 +01:00
Erik Eckstein
cc68bd98c9
Swift Optimizer: rework pass context types and instruction passes
...
* split the `PassContext` into multiple protocols and structs: `Context`, `MutatingContext`, `FunctionPassContext` and `SimplifyContext`
* change how instruction passes work: implement the `simplify` function in conformance to `SILCombineSimplifyable`
* add a mechanism to add a callback for inserted instructions
2023-01-16 15:11:34 +01:00