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

define i64 @test(i64** noalias %p, i64* noalias %q) {
; CHECK-LABEL: @test(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    store i64* [[Q:%.*]], i64** [[P:%.*]], align 8
; CHECK-NEXT:    br i1 false, label [[IF:%.*]], label [[MERGE:%.*]]
; CHECK:       if:
; CHECK-NEXT:    call void @clobber(i64** [[P]])
; CHECK-NEXT:    br label [[MERGE]]
; CHECK:       merge:
; CHECK-NEXT:    store i64 1, i64* [[Q]], align 4
; CHECK-NEXT:    [[Q3:%.*]] = getelementptr i64, i64* [[Q]], i64 1
; CHECK-NEXT:    store i64 2, i64* [[Q3]], align 4
; CHECK-NEXT:    ret i64 1
;
entry:
  store i64* %q, i64** %p
  br i1 false, label %if, label %merge

if:
  call void @clobber(i64** %p)
  br label %merge

merge:
  %q2 = load i64*, i64** %p
  store i64 1, i64* %q2
  %v = load i64, i64* %q
  %q3 = getelementptr i64, i64* %q, i64 %v
  store i64 2, i64* %q3
  %v2 = load i64, i64* %q
  ret i64 %v2
}

declare void @clobber(i64** %p)