Skip to content

Add new cast pattern in SILCombine #31595

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

Merged
merged 1 commit into from
May 12, 2020
Merged

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented May 6, 2020

Add pattern to catch the following redundant conversion:

%tmp1 = thick_to_objc_metatype %x
%tmp2 = objc_to_thick_metatype %tmp1
...
%tmp3 = <sil operation> %tmp2

to:

%tmp3 = <sil operation> %x

Similarly add pattern for redundant conversion of objc_to_thick_metatype
followed by thick_to_objc_metatype.

Fixes rdar://62932799

@meg-gupta meg-gupta requested a review from gottesmm May 6, 2020 19:35
Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, from what I can see you only added a test for one way, unless I am reading incorrectly. Can you add another test with the other direction?

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented May 6, 2020

Build failed
Swift Test Linux Platform
Git Sha - 6dccd828e4ea7124d841183551d0a0fdb9af649c

@swift-ci
Copy link
Contributor

swift-ci commented May 6, 2020

Build failed
Swift Test OS X Platform
Git Sha - 6dccd828e4ea7124d841183551d0a0fdb9af649c

@gottesmm
Copy link
Contributor

gottesmm commented May 7, 2020

@meg-gupta can you make sure to squash this before you land it/give it a nice commit message. The commit history is the narrative that we leave for our future selves!

Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding both versions of the tests! = ). This commit is starting to look really beautiful! I have a few more small things below though on the FileCheck lines that will make your tests more robust in the face of future changes!

@meg-gupta
Copy link
Contributor Author

meg-gupta commented May 7, 2020

I'll update the FileCheck changes. And will squash merge.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented May 7, 2020

Build failed
Swift Test Linux Platform
Git Sha - cde469d5892899e6d8d2d8fb4014f7723dae6aba

@swift-ci
Copy link
Contributor

swift-ci commented May 7, 2020

Build failed
Swift Test OS X Platform
Git Sha - 6babbf24d4a8425173798f1360f5e88f7757666d

@meg-gupta
Copy link
Contributor Author

@swift-ci test

…atype conversions

Add pattern to catch the following redundant conversion:

%tmp1 = thick_to_objc_metatype %x
%tmp2 = objc_to_thick_metatype %tmp1
...
%tmp3 = <sil operation> %tmp2

to:

%tmp3 = <sil operation> %x

Similarly add pattern for redundant conversion of objc_to_thick_metatype
followed by thick_to_objc_metatype.

Fixes rdar://62932799
@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test and merge

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test

@meg-gupta meg-gupta merged commit 488333c into swiftlang:master May 12, 2020
aschwaighofer added a commit that referenced this pull request May 12, 2020
…objc metatype conversions (#31595)"

This reverts commit 488333c.

It looks like this might have caused a heap-use-after free on an asan
bot.

rdar://63135437
meg-gupta added a commit to meg-gupta/swift that referenced this pull request May 12, 2020
Add new pattern in SILCombine to optimize redundant thick to objc metatype conversions

Add pattern to catch the following redundant conversion:

%tmp1 = thick_to_objc_metatype %x
%tmp2 = objc_to_thick_metatype %tmp1
...
%tmp3 = <sil operation> %tmp2

to:

%tmp3 = <sil operation> %x

Similarly add pattern for redundant conversion of objc_to_thick_metatype
followed by thick_to_objc_metatype.

Fixes rdar://62932799
meg-gupta added a commit that referenced this pull request May 12, 2020
Add new pattern in SILCombine to optimize redundant thick to objc metatype conversions

Add pattern to catch the following redundant conversion:

%tmp1 = thick_to_objc_metatype %x
%tmp2 = objc_to_thick_metatype %tmp1
...
%tmp3 = <sil operation> %tmp2

to:

%tmp3 = <sil operation> %x

Similarly add pattern for redundant conversion of objc_to_thick_metatype
followed by thick_to_objc_metatype.

Fixes rdar://62932799
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants