Skip to content
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

[SR-1455] Xcode 7.3.1 Compiler Crash: While running SILModuleTransform "Function Signature Optimization". #44064

Closed
swift-ci opened this issue May 9, 2016 · 10 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented May 9, 2016

Previous ID SR-1455
Radar rdar://problem/26179597
Original Reporter st3fan (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

OS X 10.11.4 / Xcode 7.3.1

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee trentxintong (JIRA)
Priority Medium

md5: 98ddeb9c3528d0024d737022162fc18c

Issue Description:

While compiling the v4.x branch of Firefox for iOS. No problems with Xcode 7.3. Only on optimized builds.

0  swift                    0x000000010f89a66b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1  swift                    0x000000010f899956 llvm::sys::RunSignalHandlers() + 70
2  swift                    0x000000010f89accf SignalHandler(int) + 287
3  libsystem_platform.dylib 0x00007fff9a0b752a _sigtramp + 26
4  libsystem_platform.dylib 0x0000000110a22a00 _sigtramp + 1989588208
5  swift                    0x000000010d74fde5 swift::SILFunction::shouldOptimize() const + 117
6  swift                    0x000000010d9e858c (anonymous namespace)::FunctionSignatureOpts::run() + 364
7  swift                    0x000000010d8d2d11 swift::SILPassManager::runModulePass(swift::SILModuleTransform*) + 1025
8  swift                    0x000000010d8d353e swift::SILPassManager::runOneIteration() + 686
9  swift                    0x000000010d8d960e swift::runSILOptimizationPasses(swift::SILModule&) + 462
10 swift                    0x000000010d5ed579 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 13193
11 swift                    0x000000010d5e968d frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2781
12 swift                    0x000000010d5e50ac main + 1932
13 libdyld.dylib            0x00007fff95a0d5ad start + 1
14 libdyld.dylib            0x00000000000000d4 start + 1784621864

While running SILModuleTransform "Function Signature Optimization".

Full log attached

Please let me know what other info I can provide. Workaround welcome, or hints on how to change code to not trigger this crash.

@jckarter
Copy link
Member

jckarter commented May 9, 2016

Speculatively assigning to Michael as performance team ambassador since BobW doesn't seem to have a Jira account yet.

@swift-ci
Copy link
Collaborator Author

swift-ci commented May 9, 2016

Comment by Xin Tong (JIRA)

Stefan Arentz , can you please give me some instructions on how to reproduce this crash, i.e. where to get the firefox source code ?

Thanks.

@jckarter
Copy link
Member

jckarter commented May 9, 2016

trentxintong (JIRA User) The firefox-ios project is on github: https://github.com/mozilla/firefox-ios

@swift-ci
Copy link
Collaborator Author

swift-ci commented May 9, 2016

Comment by Xin Tong (JIRA)

OK. they are using the 4.x branch. Thanks Joe.

@swift-ci
Copy link
Collaborator Author

Comment by Stefan Arentz (JIRA)

Build instructions for Firefox for iOS:

brew install carthage
git clone https://github.com/mozilla/firefox-ios
cd firefox-ios
git checkout v4.x # Bug confirmed on the v4.x branch but I'm pretty sure master is affected too
sh ./bootstrap.sh

At this point you can open Client.xcodeproj and build the FennecAurora or Firefox schemes. Both are optimized production builds. The default Fennec scheme is for a development and non-optimized build.

Please note that I can't explain how to get past code signing errors. But you probably can work around that rather easily, being Apple.

@swift-ci
Copy link
Collaborator Author

Comment by Stefan Arentz (JIRA)

Xin, if you were able to narrow this down to a specific function, would you please let us know? We currently have -whole-module-optimization removed for the target that is causing the crash, but I'd like to narrow it down to just a specific function.

@swift-ci
Copy link
Collaborator Author

Comment by Xin Tong (JIRA)

Stefan, this problem has been fixed on swift trunk https://github.com/apple/swift. But for now, you can add this option to Swift Compiler - Custom Flags

-Xllvm -sil-disable-pass="Speculative Devirtualization"

to avoid the problem. This might have some performance degradation, but very likely small.

@swift-ci
Copy link
Collaborator Author

Comment by Stefan Arentz (JIRA)

Thank you all for the quick response. We currently have optimizations turned off completely but I will follow your advice of just using -Xllvm -sil-disable-pass="Speculative Devirtualization".

@swift-ci
Copy link
Collaborator Author

Comment by Stefan Arentz (JIRA)

Thank you Xin. The crash does not happen anymore with your suggested compiler flags added.

@swift-ci
Copy link
Collaborator Author

Comment by Xin Tong (JIRA)

No problem. With upcoming Swift 3 release, you should be able to turn off the flag.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants