[swift-dev] Emitted SIL does not parse

Ben Ng me at benng.me
Tue Apr 4 21:41:00 CDT 2017


Do you mean like:

> $ swiftc -O moof.sil -o moof -Xfrontend -assume-parsing-unqualified-ownership-sil

It seems like the `-assume-parsing-unqualified-ownership-sil` argument isn’t understood without the -Xfrontend flag.

The above command results in a different error:

> Cannot construct Inlined loc from the given location.
> UNREACHABLE executed at /swift/lib/SIL/SILLocation.cpp:209!
> 0  swift                    0x000000010ee694d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
> 1  swift                    0x000000010ee69b86 SignalHandler(int) + 454
> 2  libsystem_platform.dylib 0x00007fffa3c8eb3a _sigtramp + 26
> 3  libsystem_platform.dylib 0x0000000100000001 _sigtramp + 1547113697
> 4  libsystem_c.dylib        0x00007fffa3b13420 abort + 129
> 5  swift                    0x000000010ee06bd7 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 471
> 6  swift                    0x000000010c670d83 swift::InlinedLocation::getInlinedLocation(swift::SILLocation) + 387
> 7  swift                    0x000000010c3a64af swift::SILInliner::inlineFunction(swift::FullApplySite, llvm::ArrayRef<swift::SILValue>) + 255
> 8  swift                    0x000000010c48f93e (anonymous namespace)::SILPerformanceInlinerPass::run() + 1854
> 9  swift                    0x000000010c3c9732 swift::SILPassManager::runPassOnFunction(swift::SILFunctionTransform*, swift::SILFunction*) + 2258
> 10 swift                    0x000000010c3ca5ba swift::SILPassManager::runFunctionPasses(llvm::ArrayRef<swift::SILFunctionTransform*>) + 1082
> 11 swift                    0x000000010c3cb8d4 swift::SILPassManager::runOneIteration() + 948
> 12 swift                    0x000000010bca963b swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 187
> 13 swift                    0x000000010c3d4322 swift::runSILOptimizationPasses(swift::SILModule&) + 114
> 14 swift                    0x000000010bb54fb7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 12887
> 15 swift                    0x000000010bb0f8f0 main + 3312
> 16 libdyld.dylib            0x00007fffa3a7f235 start + 1
> 17 libdyld.dylib            0x000000000000000f start + 1549274587

So, I tried again without optimizations, and got this instead:

> $ swiftc moof.sil -o moof -Xfrontend -assume-parsing-unqualified-ownership-sil
>
> Undefined symbols for architecture x86_64:
>   "__T0s27_allocateUninitializedArraySayxG_BptBwlFyp_Tgq5", referenced from:
>       _main in .last_generated-41ab00.o
> ld: symbol(s) not found for architecture x86_64

Ben Ng
https://benng.me

On Apr 4, 2017, 2:02 AM -0400, Michael Gottesman <mgottesman at apple.com>, wrote:
>
> > On Apr 3, 2017, at 7:55 PM, Ben Ng via swift-dev <swift-dev at swift.org> wrote:
> >
> > I see that SR-3774 already exists, but that ticket was about declarations not appearing in the emitted SIL.
> >
> > I'm able to get declarations to appear with the -frontend flag, but the emitted SIL still doesn't parse on master:
> >
> > > $  echo 'print("moof")' > test.swift
> > > $  swiftc -frontend -emit-sil test.swift > test.sil
> > > $  swiftc -parse-sil test.sil
> > >
> > > Assertion failed: ((Qualifier != StoreOwnershipQualifier::Unqualified) || F.hasUnqualifiedOwnership() && "Unqualified inst in qualified function"), function createStore, file /swift-dev/swift/include/swift/SIL/SILBuilder.h, line 503.
> > > 0  swift                    0x000000011298d4d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
> > > 1  swift                    0x000000011298db86 SignalHandler(int) + 454
> > > 2  libsystem_platform.dylib 0x00007fffa48ceb3a _sigtramp + 26
> > > 3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1534268640
> > > 4  libsystem_c.dylib        0x00007fffa4753420 abort + 129
> > > 5  libsystem_c.dylib        0x00007fffa471a893 basename_r + 0
> > > 6  swift                    0x000000011017b2fc swift::SILBuilder::createStore(swift::SILLocation, swift::SILValue, swift::SILValue, swift::StoreOwnershipQualifier) + 396
> > > 7  swift                    0x000000011038ddec (anonymous namespace)::SILParser::parseSILInstruction(swift::SILBasicBlock*, swift::SILBuilder&) + 70412
> > > 8  swift                    0x0000000110373217 swift::Parser::parseDeclSIL() + 5111
> > > 9  swift                    0x000000011033112d swift::Parser::parseTopLevel() + 269
> > > 10 swift                    0x0000000110367edb swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 283
> > > 11 swift                    0x000000011011da0c swift::CompilerInstance::performSema() + 3580
> > > 12 swift                    0x000000010f676f6d swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4621
> > > 13 swift                    0x000000010f6338f0 main + 3312
> > > 14 libdyld.dylib            0x00007fffa46bf235 start + 1
> >
> > Is this a bug? Am I using the wrong combination of flags?
>
> You need the flag -assume-parsing-unqualified-ownership-sil.
>
> >
> > Ben Ng
> > https://benng.me
> > _______________________________________________
> > swift-dev mailing list
> > swift-dev at swift.org
> > https://lists.swift.org/mailman/listinfo/swift-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170404/1fc97da6/attachment.html>


More information about the swift-dev mailing list