Closed
Description
$ cat <<EOF > rdar113994760.ll
source_filename = "rdar113994760.ll"
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx"
define swiftcc void @"$s4main11call_foobaryyF"() personality ptr @__gcc_personality_v0 {
entry:
%swifterror = alloca swifterror ptr, align 8
invoke swiftcc void null(i64 0, ptr null, ptr swifterror %swifterror)
to label %.noexc unwind label %tsan_cleanup
.noexc: ; preds = %entry
ret void
tsan_cleanup: ; preds = %entry
%cleanup.lpad = landingpad { ptr, i32 }
cleanup
resume { ptr, i32 } zeroinitializer
}
declare i32 @__gcc_personality_v0(...)
EOF
$ ./build/bin/llc rdar113994760.ll -filetype=obj -o out
LLVM ERROR: sleb128 and uleb128 expressions must be absolute
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ./build/bin/llc rdar113994760.ll -filetype=obj -o out
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 llc 0x0000000105f11d60 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 llc 0x0000000105f12134 SignalHandler(int) + 188
2 libsystem_platform.dylib 0x00000001a87e1a84 _sigtramp + 56
3 libsystem_pthread.dylib 0x00000001a87b2c28 pthread_kill + 288
4 libsystem_c.dylib 0x00000001a86c1b28 abort + 180
5 llc 0x0000000105e98e48 llvm::report_fatal_error(llvm::Twine const&, bool) + 328
6 llc 0x0000000105e98d00 llvm::report_fatal_error(llvm::Twine const&, bool) + 0
7 llc 0x0000000105a79690 llvm::MCAssembler::relaxBoundaryAlign(llvm::MCAsmLayout&, llvm::MCBoundaryAlignFragment&) + 0
8 llc 0x0000000105a79d64 llvm::MCAssembler::layoutSectionOnce(llvm::MCAsmLayout&, llvm::MCSection&) + 72
9 llc 0x0000000105a78ecc llvm::MCAssembler::layoutOnce(llvm::MCAsmLayout&) + 112
10 llc 0x0000000105a78a88 llvm::MCAssembler::layout(llvm::MCAsmLayout&) + 404
11 llc 0x0000000105a78ffc llvm::MCAssembler::Finish() + 64
12 llc 0x0000000105a976a8 (anonymous namespace)::MCMachOStreamer::finishImpl() + 644
13 llc 0x000000010554014c llvm::AsmPrinter::doFinalization(llvm::Module&) + 3232
14 llc 0x00000001059fe330 llvm::FPPassManager::doFinalization(llvm::Module&) + 76
15 llc 0x00000001059fa568 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 960
16 llc 0x0000000104d2d6e8 main + 6100
17 dyld 0x00000001a8457f28 start + 2236
Abort trap: 6
rdar://113994760
This regression happened sometime between clang-15 and clang-16. Bisection points at 648ce3d:
commit 648ce3d358560c0f60340fcf28ad2563d213eca2
Author: James Y Knight <[email protected]>
Date: Fri Jan 6 13:26:03 2023 -0500
Cleanup unwind table emission code a bit.
This change removes the `tidyLandingPads` function, which previously
had a few responsibilities:
1. Dealing with the deletion of an invoke, after MachineFunction lowering.
2. Dealing with the deletion of a landing pad BB, after MachineFunction lowering.
3. Cleaning up the type-id list generated by `MachineFunction::addLandingPad`.
Case 3 has been fixed in the generator, and the others are now handled
during table emission.
This change also removes `MachineFunction`'s `addCatchTypeInfo`,
`addFilterTypeInfo`, and `addCleanup` helper fns, as they had a single
caller, and being outlined didn't make it simpler.
Finally, as calling `tidyLandingPads` was effectively the only thing
`DwarfCFIExceptionBase` did, that class has been eliminated.