llvm/llvm/test/Transforms/EarlyCSE/writeonly.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=early-cse -earlycse-debug-hash < %s | FileCheck %s

@var = global i32 undef
declare void @foo() nounwind

define void @test() {
; CHECK-LABEL: @test(
; CHECK-NEXT:    call void @foo() #[[ATTR1:[0-9]+]]
; CHECK-NEXT:    store i32 2, ptr @var, align 4
; CHECK-NEXT:    ret void
;
  store i32 1, ptr @var
  call void @foo() writeonly
  store i32 2, ptr @var
  ret void
}