Commit Graph

11 Commits

Author SHA1 Message Date
zoecarver
48513f3c5b [embedded] Introduce isGenericFunction and addAllNonGenericFunctions. 2023-09-06 10:48:17 -07:00
zoecarver
52cea4250e [embedded] 🚀 add Embedded expiremental feature.
Optimize all functions in embedded mode. Diagnose any uses of existentials or witness tables.
2023-09-06 10:48:17 -07:00
Manu
02b5fa2c8e Fix some typos in the codebase 2023-08-31 18:50:10 -03:00
Meghana Gupta
9f93ba003e Don't inline non-ossa function into an ossa function in mandatory inlining
Update the inliner with this check.
Inlining non-ossa into ossa can causes unexpected consequences.

Fixes rdar://114466605
2023-08-25 21:46:50 -07:00
Erik Eckstein
538d7306bd MandatoryPerformanceOptimizations: better handling of statically initialized globals which contain a pointer to another global
E.g.
```
  var p = Point(x: 10, y: 20)
  let o = UnsafePointer(&p)
```

MandatoryPerformanceOptimization must inline the accessor to the referenced global.
2023-08-10 20:49:20 +02:00
Erik Eckstein
8223b3e210 MandatoryPerformanceOptimizations: fix some problems with inilning
* don't inline functions if it's not possible - by checking `SILInliner::canInlineApplySite`
* fix stack nesting after inlining a `begin_apply`
2023-08-10 15:01:47 +02:00
Erik Eckstein
64255651f5 MandatoryPerformanceOptimizations: refine the inlining decisions in global initializers
We inline a function (e.g. a struct initializer) into a global init function if the result is part of the initialized global.
Now, also handle functions with indirect return values. Such function can result from not-reabstracted generic specializations.
Handle cases where the result is stored into a temporary alloc_stack or directly stored to (a part) of the global variable.
2023-07-26 11:06:50 +02:00
Kuba Mracek
2bf728d6cb MandatoryPerformanceOptimizations: Use Set<PathFunctionTuple> to track inlined functions 2023-07-10 08:58:13 -07:00
Kuba Mracek
145f12f6a3 Allow using structs with trivial initializers in globals that require static initialization (e.g. @_section attribute)
Before this change, if a global variable is required to be statically initialized (e.g. due to @_section attribute), we don't allow its type to be a struct, only a scalar type works. This change improves on that by teaching MandatoryPerformanceOptimizations pass to inline struct initializer calls into initializer of globals, as long as they are simple enough so that we can be sure that we don't trigger recursive/infinite inlining.
2023-07-08 19:26:59 -07:00
Erik Eckstein
fccecbe15e MandatoryPerformanceOptimizations: remove dead metatype instructions after specialization
Generic specialization drops metatype arguments and therefore exposes opportunities to remove dead metatype instructions.
Instead of removing dead metatype instructions before specialization, try to remove them after specialization.
2023-06-15 21:42:01 +02:00
Erik Eckstein
dc3cb18029 Swift Optimizer: add the MandatoryPerformanceOptimizations pass
As a replacement for the old MandatoryGenericSpecializer

The pass it not enabled yet in the pass pipeline
2023-05-11 08:11:44 +02:00