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

    <tr>
        <th>Summary</th>
        <td>
            aarch64 global isel: LLVM ERROR: Use not jointly dominated by defs
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AArch64,
            globalisel,
            crash-on-valid
      </td>
    </tr>

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

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

<pre>
    I'm getting a crash for this IR:
```llvm
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-linux-gnu"

define i18 @f(i27 %0) {
  %2 = sext i27 %0 to i32
  %3 = sext i1 true to i32
  %4 = sdiv i32 %2, %3
  %5 = sext i1 true to i32
  %6 = icmp ule i32 %4, %5
  %7 = sext i27 %0 to i32
 %8 = sext i1 %6 to i32
  %9 = srem i32 %7, %8
  %10 = trunc i32 %9 to i18
  ret i18 %10
}
```

```
Johns-MacBook-Pro:tmp regehr$ llc --global-isel --march=aarch64 reduced.ll 
Use of %9 does not have a corresponding definition on every path:
48r %5:gpr32 = SDIVWr %2:gpr32, %9:gpr32
LLVM ERROR: Use not jointly dominated by defs.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc --global-isel reduced.ll
1.      Running pass 'Function Pass Manager' on module 'reduced.ll'.
2.      Running pass 'Live Interval Analysis' on function '@f'
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  libLLVMSupport.dylib     0x000000010b847c88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 libLLVMSupport.dylib     0x000000010b846b0c llvm::sys::RunSignalHandlers() + 112
2  libLLVMSupport.dylib     0x000000010b848314 SignalHandler(int) + 344
3  libsystem_platform.dylib 0x00000001989082a4 _sigtramp + 56
4 libsystem_pthread.dylib  0x00000001988d9cec pthread_kill + 288
5 libsystem_c.dylib        0x00000001988122c8 abort + 180
6 libLLVMSupport.dylib     0x000000010b796600 llvm::report_fatal_error(llvm::Twine const&, bool) + 280
7 libLLVMSupport.dylib     0x000000010b7964e8 llvm::report_fatal_error(llvm::Twine const&, bool) + 0
8 libLLVMCodeGen.dylib     0x000000010cbcdaf4 llvm::LiveRangeCalc::findReachingDefs(llvm::LiveRange&, llvm::MachineBasicBlock&, llvm::SlotIndex, unsigned int, llvm::ArrayRef<llvm::SlotIndex>) + 4284
9  libLLVMCodeGen.dylib 0x000000010cbcc9ac llvm::LiveRangeCalc::extend(llvm::LiveRange&, llvm::SlotIndex, unsigned int, llvm::ArrayRef<llvm::SlotIndex>) + 200
10 libLLVMCodeGen.dylib     0x000000010cbd0c48 llvm::LiveIntervalCalc::extendToUses(llvm::LiveRange&, llvm::Register, llvm::LaneBitmask, llvm::LiveInterval*) + 600
11 libLLVMCodeGen.dylib 0x000000010cbd0888 llvm::LiveIntervalCalc::calculate(llvm::LiveInterval&, bool) + 1056
12 libLLVMCodeGen.dylib     0x000000010cbb34dc llvm::LiveIntervals::computeVirtRegInterval(llvm::LiveInterval&) + 140
13 libLLVMCodeGen.dylib     0x000000010cbb2024 llvm::LiveIntervals::computeVirtRegs() + 156
14 libLLVMCodeGen.dylib 0x000000010cbb1ec4 llvm::LiveIntervals::runOnMachineFunction(llvm::MachineFunction&) + 552
15 libLLVMCodeGen.dylib     0x000000010cc7c458 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 616
16 libLLVMCore.dylib        0x000000010dd1459c llvm::FPPassManager::runOnFunction(llvm::Function&) + 704
17 libLLVMCore.dylib        0x000000010dd1b2cc llvm::FPPassManager::runOnModule(llvm::Module&) + 60
18 libLLVMCore.dylib 0x000000010dd14b70 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 764
19 llc                      0x0000000104549194 compileModule(char**, llvm::LLVMContext&) + 5672
20 llc                      0x0000000104547520 main + 1128
21 dyld                     0x00000001985afe50 start + 2544
Abort trap: 6
Johns-MacBook-Pro:tmp regehr$ 
```

there's this previous instance of seeing this error https://github.com/llvm/llvm-project/issues/38246 but the circumstances are different enough that this seemed worth reporting freshly
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysWN1S4zoSfhpx0xXKlv8vcmGGYQ9bUEOFObO1e0PJcsfWQZZSksyQffot-ScxgWVydk8KApFb3d_X3Wp1h1krGoW4JskVSa4vWO9abdYGG2zNRaXr_fqW0KyDBp0TqgEG3DDbwlYbcK2wcLshUUmCaxKUJA3GHylfunHJMdOgg5o5Jtle9w5IdA2EUlx1JCpxJXISlf43oisRpiQqhzf_KY1JVKbxSoTUC4Q0X6mIjmuPfo3SN0acETuJswHGDG_TeCWF6l9XjeoP4uN7jVuhEESYA4mDLaG5oBkQmgSEFkCyq1EM_BIdlFp8dTALgdMgIroQihZCITjT43uZeJSpxYt_MKgm9MuweyGVnKEpHWQE73bQS5y1xZO2ZCGZ_Qo8oUn-xuKg_p3FYpQx2M3WsslavpAKg0HMmV7xWa4YlIUHMYNu9LsXn2KSXZ_k0DJWJ4t_162yq3vGr7R-Xj0YTaLSdTsYs5bQGKTksFo1UldMroRFCatV5xOCRNdTYoDBuudYX0oJo9rfLYLejoBrjRaUdtCyF_RJr41Bu9Oq9odgyB3hhFagFeALmj3smGsPJyHOzRiGqGx2Jhrz5_H69sc_zBj0aX1yYHH4POy-u_txD183m2_-aIGH5ZH8oYVycg-17oRiDmuo9h6JvRx3Pdx9LR-_gu2rTjhgUPUNGNxp47z7W-d21uOjN4TeNMK1fXXJdUfozXBaxz-rndF_IHeE3ghre7SE3gBTNQjFZV8juBanAlAx_uwM4ziZf3SMP0Pdd7uDF4JLEhQPRjeGdcBM03eonAfxQXyO0Rj3hn7vplfK-3vHrAVCs5te8cHrD37hninWoCE081HodO0PAqHZQhXNJnT0I3V34gXhVjk0L0xCqZ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