-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Optimizer: reimplement DeadStoreElimination in swift #67122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci test |
@swift-ci benchmark |
@swift-ci test compiler performance |
Nice! |
Instead of aliasAnalysis.mayRead(inst: i, fromAddress: a) it's more natural to write i.mayRead(fromAddress: a, aliasAnalysis)
add field types: `x`: existential address projection, like `open_existential_addr` `i<n>`: indexed element with constant index, like `index_addr` with an integer literal as index `i*`: indexed element with an unknown index
* `createStructExtract` * `createStructElementAddr` * `createTupleExtract` * `createTupleElementAddr`
Also add `Value.referenceRoot`
debug_value just "reads" the operand if it is an address.
The old C++ pass didn't catch a few cases. Also: * The new pass is significantly simpler: it doesn't perform dataflow for _all_ memory locations at once using bitfields, but handles each store separately. (In both implementations there is a complexity limit in place to avoid quadratic complexity) * The new pass works with OSSA
ec5dd42
to
baaf556
Compare
@swift-ci test |
@swift-ci benchmark |
@swift-ci test compiler performance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Swift utilities all look great!
I don't know if this is the most efficient or powerful global DSE algorithm but it is definitely the easiest to understand and maintain.
@eeckstein I have several requests for clarification in the form of naming, comments, asserts and TODOs which I hope you will consider.
SwiftCompilerSources/Sources/Optimizer/FunctionPasses/DeadStoreElimination.swift
Show resolved
Hide resolved
SwiftCompilerSources/Sources/Optimizer/FunctionPasses/DeadStoreElimination.swift
Show resolved
Hide resolved
SwiftCompilerSources/Sources/Optimizer/FunctionPasses/DeadStoreElimination.swift
Show resolved
Hide resolved
SwiftCompilerSources/Sources/Optimizer/FunctionPasses/DeadStoreElimination.swift
Show resolved
Hide resolved
SwiftCompilerSources/Sources/Optimizer/FunctionPasses/DeadStoreElimination.swift
Show resolved
Hide resolved
Addresses review feedback of swiftlang#67122
Addresses review feedback of swiftlang#67122
The old C++ pass didn't catch a few cases.
Also: