optimize keypath instructions#24929
Conversation
|
@swift-ci test |
There was a problem hiding this comment.
Should we try this more generally on all address values, not only begin_applys?
There was a problem hiding this comment.
This is the call of the keypath runtime function itself. It can only be an apply or begin_apply.
There was a problem hiding this comment.
Thanks, sorry, I got it confused with "begin_access".
|
Build failed |
|
@swift-ci test linux |
Just out of curiosity, it would not yet be able to optimize something more complex like this segment in DriverUtils, correct? …
func deltaEquation(_ stat: KeyPath<rusage, Int>) -> String {
let b = baseline[keyPath: stat], c = current[keyPath: stat]
return "\(c) - \(b) = \(c - b)"
}
logVerbose(
"""
MAX_RSS \(deltaEquation(\rusage.ru_maxrss)) (\(pages()) pages)
ICS \(deltaEquation(\rusage.ru_nivcsw))
VCS \(deltaEquation(\rusage.ru_nvcsw))
""")
… |
|
If |
If the keypath argument of a keypath access function is a keypath literal instruction, generate the projection inline and remove the access function. For example, replaces (simplified SIL): %kp = keypath ... stored_property #Foo.bar apply %keypath_runtime_function(%root_object, %kp, %addr) with: %addr = struct_element_addr %root_object, #Foo.bar load/store %addr Currently this only handles stored property patterns. rdar://problem/36244734
56e6bbc to
da38e3a
Compare
|
@swift-ci smoke test and merge |
1 similar comment
|
@swift-ci smoke test and merge |
If the keypath argument of a keypath access function is a keypath literal instruction, generate the projection inline and remove the access function.
For example, replaces (simplified SIL):
%kp = keypath ... stored_property #Foo.bar
apply %keypath_runtime_function(%root_object, %kp, %addr)
with:
%addr = struct_element_addr %root_object, #Foo.bar
load/store %addr
Currently this only handles stored property patterns.
rdar://problem/36244734