Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -globalopt < %s | FileCheck %s

; In this case an instruction queued for recursive deletion gets RAUWd with
; a constant in the meantime. Make sure this does not cause an assertion
; failure.

@a = internal global i32** null
@b = internal global i32*** @a

define void @test() {
; CHECK-LABEL: @test(
; CHECK-NEXT:    ret void
;
  %v1 = load i32***, i32**** @b
  %v2 = load i32**, i32*** %v1
  store i32** %v2, i32*** @a
  ret void
}