llvm-link: Missing Dwarf DIE references

I am experiencing an issue combining bitcode files for the purpose of generating the combined bitcodes as a single bitcode file. I would like to have any pointers to help me debug this or maybe it has been seen before and a fix is either being worked on or is done.

I am using the Xcode 9.0 compiler. I believe the Swift code is 3.x. I have reproduced this using the tot llvm-link.

The input modules are from Swift (LucidDreams) and have been compiled -O. The problem doesn’t seem to exist when they are compiled -Onone.

The llvm-link occurs without error and the subsequent compilation also seems to go fine, but when the resultant llvm-dwarfdump -verbose -verify is run I get a bunch of the following errors:

warning: could not find referenced DIE
in DIE:

0x0000a33f: DW_TAG_inlined_subroutine [20] *
DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x0c84 => {0x0000a40d})
DW_AT_ranges [DW_FORM_sec_offset] (0x00021960
[0x0000000000001878 - 0x000000000000187c)
[0x00000000000018b0 - 0x0000000000001910)
[0x0000000000001980 - 0x00000000000019e0))
DW_AT_call_file [DW_FORM_data1] ("/testprogram_lucidDreams/iOS_APP/LucidDreams/DreamListViewControllerModel.swift")
DW_AT_call_line [DW_FORM_data1] (61)
while processing /testprogram_lucidDreams/iOS_APP/DerivedData/iOS_APP/Build/Intermediates.noindex/iOS_APP.build/Debug-iphoneos/iOS_APP.build/Objects-normal/arm64/iOS_APP.bc.o:

All the errors reference DreamListViewControllerModel.swift and have todo with inlining, but if I remove enough of the input bitcode objects from the llvm-link the error goes away even though DreamListViewControllerModel is still included.

Here are the commands I used to generate the error (omitting the original Swift compile):

bitcode_files.tgz (343 KB)

I am experiencing an issue combining bitcode files for the purpose of generating the combined bitcodes as a single bitcode file. I would like to have any pointers to help me debug this or maybe it has been seen before and a fix is either being worked on or is done.

I am using the Xcode 9.0 compiler. I believe the Swift code is 3.x. I have reproduced this using the tot llvm-link.

As general note, for questions about using the Swift compiler the swift-dev mailing list on swift.org is a more appropriate forum unless the bug can also be reproduced with an unmodified llvm.oprg toolchain.

The input modules are from Swift (LucidDreams) and have been compiled -O. The problem doesn't seem to exist when they are compiled -Onone.

The llvm-link occurs without error and the subsequent compilation also seems to go fine, but when the resultant llvm-dwarfdump -verbose -verify is run I get a bunch of the following errors:

warning: could not find referenced DIE
    in DIE:

0x0000a33f: DW_TAG_inlined_subroutine [20] *
                    DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x0c84 => {0x0000a40d})
                    DW_AT_ranges [DW_FORM_sec_offset] (0x00021960
                       [0x0000000000001878 - 0x000000000000187c)
                       [0x00000000000018b0 - 0x0000000000001910)
                       [0x0000000000001980 - 0x00000000000019e0))
                    DW_AT_call_file [DW_FORM_data1] ("<mypath>/testprogram_lucidDreams/iOS_APP/LucidDreams/DreamListViewControllerModel.swift")
                    DW_AT_call_line [DW_FORM_data1] (61)
while processing <mypath>/testprogram_lucidDreams/iOS_APP/DerivedData/iOS_APP/Build/Intermediates.noindex/iOS_APP.build/Debug-iphoneos/iOS_APP.build/Objects-normal/arm64/iOS_APP.bc.o:

All the errors reference DreamListViewControllerModel.swift and have todo with inlining, but if I remove enough of the input bitcode objects from the llvm-link the error goes away even though DreamListViewControllerModel is still included.

Here are the commands I used to generate the error (omitting the original Swift compile):

########################
########################
llvm-link \
-o <mypath>/iOS_APP.bc \
<mypath>/DreamListViewController.o \
<mypath>/TextEntryCollectionViewCell.bc \
<mypath>/ImageDrawable.bc \
<mypath>/DreamScene.bc \
<mypath>/DreamListViewControllerModel.bc \
<mypath>/CreatureCollectionViewCell.bc \
<mypath>/RangeReplaceableCollection+IndexSet.bc \
<mypath>/DreamPreviewHeaderReusableView.bc \
<mypath>/Rendering.bc

########################
########################
xcrun \
--sdk iphoneos \
<mypath>/Xcode_9.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ \
-fembed-bitcode \
<mypath>/iOS_APP.bc \
-arch arm64 \
-O0 \
-c \
-o <mypath>/iOS_APP.bc.o

########################
########################
llvm-dwarfdump -verbose -verify small.o > small.o.dwarfdump

Any insights would be appreciated. Input bitcode files are attached.

Could you please file a bugreport on bugs.swift.org for this and assign it to me?

thanks,
adrian