Commit Graph

18 Commits

Author SHA1 Message Date
Erik Eckstein
2f124cf564 Remove the -enable-ossa-modules option.
OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
2025-09-26 08:01:08 +02:00
Andrew Trick
9349171a2d Reenable 32-bit tests: dead_array_elim & string_optimization
Fixes rdar://74359824 (SILOptimizer tests failing on watchsimulator-i386)
2025-07-23 12:08:41 -07:00
Meghana Gupta
d351623df0 Fix StringOptimization to handle load_borrow
rdar://140229560
2024-12-13 13:16:22 -08:00
Erik Eckstein
c7f35f99ef SILCombine: remove dead string.init_empty_with_capacity semantic calls
This avoids leftover runtime calls for constant folded large interpolated strings.

rdar://127308237
2024-05-02 10:49:33 +02:00
Meghana Gupta
5bfa560b35 Update SimplifyCFG's replacement of phi with its incoming value
Previously we replaced phi with its incoming values when all incoming values were the same.
If the phi had itself as incoming value, it wasn't optimized. This PR handles such cases.
2024-04-03 10:46:05 -07:00
Meghana Gupta
bc9af2ae46 Disable a test temporarily 2024-04-03 10:30:55 -07:00
Erik Eckstein
ed54253d29 SIL Optimizer: remove legacy C++ passes
They were used as a backup during the transition to Swift passes. Now they are not needed anymore.
2022-10-20 18:31:06 +02:00
Josh Soref
730b16c569 Spelling siloptimizer
* access
* accessed
* accesses
* accessor
* acquiring
* across
* activated
* additive
* address
* addresses'
* aggregated
* analysis
* and
* appropriately
* archetype
* argument
* associated
* availability
* barriers
* because
* been
* beginning
* belongs
* beneficial
* blocks
* borrow
* builtin
* cannot
* canonical
* canonicalize
* clazz
* cleanup
* coalesceable
* coalesced
* comparisons
* completely
* component
* computed
* concrete
* conjunction
* conservatively
* constituent
* construct
* consuming
* containing
* covered
* creates
* critical
* dataflow
* declaration
* defined
* defining
* definition
* deinitialization
* deliberately
* dependencies
* dependent
* deserialized
* destroy
* deterministic
* deterministically
* devirtualizes
* diagnostic
* diagnostics
* differentiation
* disable
* discipline
* dominate
* dominates
* don't
* element
* eliminate
* eliminating
* elimination
* embedded
* encounter
* epilogue
* epsilon
* escape
* escaping
* essential
* evaluating
* evaluation
* evaluator
* executing
* existential
* existentials
* explicit
* expression
* extended
* extension
* extract
* for
* from
* function
* generic
* guarantee
* guaranteed
* happened
* heuristic
* however
* identifiable
* immediately
* implementation
* improper
* include
* infinite
* initialize
* initialized
* initializer
* inside
* instruction
* interference
* interferes
* interleaved
* internal
* intersection
* intractable
* intrinsic
* invalidates
* irreducible
* irrelevant
* language
* lifetime
* literal
* looks
* materialize
* meaning
* mergeable
* might
* mimics
* modification
* modifies
* multiple
* mutating
* necessarily
* necessary
* needsmultiplecopies
* nonetheless
* nothing
* occurred
* occurs
* optimization
* optimizing
* original
* outside
* overflow
* overlapping
* overridden
* owned
* ownership
* parallel
* parameter
* paths
* patterns
* pipeline
* plottable
* possible
* potentially
* practically
* preamble
* precede
* preceding
* predecessor
* preferable
* preparation
* probably
* projection
* properties
* property
* protocol
* reabstraction
* reachable
* recognized
* recursive
* recursively
* redundant
* reentrancy
* referenced
* registry
* reinitialization
* reload
* represent
* requires
* response
* responsible
* retrieving
* returned
* returning
* returns
* rewriting
* rewritten
* sample
* scenarios
* scope
* should
* sideeffects
* similar
* simplify
* simplifycfg
* somewhat
* spaghetti
* specialization
* specializations
* specialized
* specially
* statistically
* substitute
* substitution
* succeeds
* successful
* successfully
* successor
* superfluous
* surprisingly
* suspension
* swift
* targeted
* that
* that our
* the
* therefore
* this
* those
* threshold
* through
* transform
* transformation
* truncated
* ultimate
* unchecked
* uninitialized
* unlikely
* unmanaged
* unoptimized key
* updataflow
* usefulness
* utilities
* villain
* whenever
* writes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-10-03 18:31:33 -04:00
Erik Eckstein
f3d1c34eb5 StringOptimization: don't constant fold dynamic Self type names.
This wrongly results in "Self" instead of the real type name.

rdar://76113269
2021-04-02 08:41:01 +02:00
Michael Gottesman
090a592896 Disable two tests on 32 bit until they are updated.
Unblocking the bots.
2021-03-02 11:15:06 -08:00
Andrew Trick
ba9f52071b OSSA: simplify-cfg support for trivial block arguments.
Enable most simplify-cfg optimizations as long as the block arguments
have trivial types. Enable most simplify CFG unit tests cases.

This massively reduces the size of the CFG during OSSA passes.

Test cases that aren't supported in OSSA yet have been moved to a
separate test file for disabled OSSA tests,

Full simplify-cfg support is currently blocked on OSSA utilities which
I haven't checked in yet.
2021-02-23 22:47:59 -08:00
Slava Pestov
b9092e4944 Temporarily disable three SILOptimizer tests on 32-bit
The proper fix is tracked by rdar://problem/74359824.
2021-02-15 16:12:43 -05:00
Erik Eckstein
b8485d6d14 StringOptimization: fix a crash when constant folding the type name of an inner class
rdar://problem/66540633
2020-08-05 11:34:34 +02:00
Erik Eckstein
63c275c45f SILOptimizer: move String concatination optimization from SILCombine/ConstantFolding to StringOptimization.
This simplifies some code and it's not required to try this optimization on every run of SILCombine and ConstantPropagation.
2020-08-04 16:16:11 +02:00
Erik Eckstein
e3f3b75208 StringOptimization: handle static let variables for String constant folding.
For example, constant fold:

struct Str {
    static let s = "hello"
}
...
let x = "<\(Str.s)>"
2020-08-03 12:01:29 +02:00
Erik Eckstein
1b7bb4940a StringOptimization: fix a test for linux and windows. 2020-07-30 17:46:09 +02:00
Erik Eckstein
5f3e79b84e StringOptimization: bug fixes
Fix some bugs in the optimization and in the test files.

rdar://problem/66283894
2020-07-30 11:32:39 +02:00
Erik Eckstein
7f684b62e2 SIL optimizer: Add a new string optimization.
Optimizes String operations with constant operands.

Specifically:
  * Replaces x.append(y) with x = y if x is empty.
  * Removes x.append("")
  * Replaces x.append(y) with x = x + y if x and y are constant strings.
  * Replaces _typeName(T.self) with a constant string if T is statically known.

With this optimization it's possible to constant fold string interpolations, like "the \(Int.self) type" -> "the Int type"

This new pass runs on high-level SIL, where semantic calls are still in place.

rdar://problem/65642843
2020-07-27 21:32:56 +02:00