<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64826>64826</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            LLVM ERROR: sleb128 and uleb128 expressions must be absolute
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jroelofs
      </td>
    </tr>
</table>

<pre>
    ```
$ 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 648ce3d358560c0f60340fcf28ad2563d213eca2:
```
commit 648ce3d358560c0f60340fcf28ad2563d213eca2
Author: James Y Knight <jyknight@google.com>
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.

```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysWF9v4zgO_zTuC5HAlh3HeehD_wU7ezOYYjo4YO8loC3a1owsGZLcNPPpD5KdxmmLaW9vgyKVbZK_H0mJJoPWikYRXUar62h1e4GDa7W5_GE0SV3bi1Lzw2WUx9NffBvFVxHLoEIHUXoTpTd3X7cQpXdgOJokSTebbJ3HSylHWasHU9GuFpIUdgRRegsRY6-EGRvlHZqGHHB0KPGgB3fUoEUXpVd60bN1HKVXKQtf_jI5v_SrPAtfC3Fc1IVXSlixUIVf5EedPFs8JKx4ie-M6OUz26ci3-XZAvte0qLDStunZ4Xxm1MtFIHdi9pVFTxqwSHKYi_FMpt1KFSSVCjlrta6RHM4bMOzImIb6MlYrVAKd4DeGa-42zVVtZs92D3GEK2vRzRSzhyidMIGiNgqIJMx2gTSKKWuEGZ3e2cidgMoRaOgOGoK9ah_vuCtBp-PQuQZxF7FUxrvjes51Bw4YpvJrNMgsSTpny-VpqcKBrUXip9uO4tqV0lCNfTzQI7iUXoFUXoNvSFupyysRq8n4oZcYDvXPbP5roWIrSbZpeyRBxmJigvVhMv19TFmImUQrW-PisfPGXvPyA5-g7_Sg19ktFDCCZTiF5mJ8tHgcQNVEg2NOm_nP2LFcrl8jvL4ffd1O12-OKNv3mQZLCO2LQchuf8vVMS2UlavDi8s_Il1h56i9FaXP2ChQQ9uNPP587-_wN23b1-_-ShbSWXCCkDFYZjW9NQbslZoZaEbrIOSAEur5eBotHH_-e7q4Q7sUHbCAUI5NGCo18b53dM611u_wdk2YttGuHYol5XuAtvH479Fb_QPqlzEtsLagWzEtoGGUJUcOIFrCSqDtoUSq5_OYEXLEf7BYfUT-ND1z8coXo5pvTe6MdgBmmboSDnP45-I2gkS9sK1vrTZQ1dqCb4wWohYQcoOhuCgB2jxkSA4OQr5jQNC-WcG7q--_wHagPWVqiUg9SiMVp4tP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