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

    <tr>
        <th>Summary</th>
        <td>
            Assert failed: An asserting value handle still pointed to this value!
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:RISC-V,
            llvm:crash
      </td>
    </tr>

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

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

<pre>
    ```
While deleting: ptr %splitgep1
An asserting value handle still pointed to this value!
UNREACHABLE executed at /root/llvm-project/llvm/lib/IR/Value.cpp:1241!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'CodeGen Prepare' on function '@f'
 #0 0x000055cae985f85f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x357585f)
 #1 0x000055cae985cfb4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f0a7417e420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007f0a73c4b00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007f0a73c2a859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x000055cae97b2efe (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x34c8efe)
 #6 0x000055cae90fec53 llvm::ValueHandleBase::ValueIsDeleted(llvm::Value*) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2e14c53)
 #7 0x000055cae90ff78d llvm::Value::~Value() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2e1578d)
 #8 0x000055cae90ff902 llvm::Value::deleteValue() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2e15902)
 #9 0x000055cae9030ad9 llvm::Instruction::eraseFromParent() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d46ad9)
#10 0x000055cae89583e5 (anonymous namespace)::CodeGenPrepare::optimizeInst(llvm::Instruction*, (anonymous namespace)::ModifyDT&) CodeGenPrepare.cpp:0:0
#11 0x000055cae895e0f8 (anonymous namespace)::CodeGenPrepare::runOnFunction(llvm::Function&) (.part.0) CodeGenPrepare.cpp:0:0
#12 0x000055cae90860b1 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d9c0b1)
#13 0x000055cae90862f9 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d9c2f9)
#14 0x000055cae9086b72 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d9cb72)
#15 0x000055cae6b72734 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#16 0x000055cae6abae86 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7d0e86)
```

```llvm
target triple = "riscv32-unknown-linux-gnu"

@G = external global i32
@G.1 = external global i32
@G.2 = external global i64
@G.3 = external global i1
@G.4 = external global i1
@G.5 = external global i8

define void @f() {
BB:
  %A1 = alloca ptr, align 8
  %G4 = getelementptr i1, ptr %A1, i32 65536
  %G = getelementptr i1, ptr %A1, i64 4294967296
  %L2 = load i8, ptr %G4, align 1
  store i8 poison, ptr %G, align 1
  ret void
}
```

https://godbolt.org/z/Y9hhKMnPr
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8l99u87oNwJ9GuRESyJL_XuQiTZqeYu0WtGcddlXINu1olSVDknvSc7FnH2S7jZ0V-7pv3QFaJKEp8keJIk1uragVwBpFVyjaLXjnjtqsi2PFrVvkunxbo5iMf2SHyOZvRyEBlyDB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