; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
%t = type { i32 }
declare void @test1f(ptr)
define void @test1(ptr noalias %stuff ) {
; CHECK-LABEL: define void @test1(
; CHECK-SAME: ptr noalias [[STUFF:%.*]]) {
; CHECK-NEXT: [[BEFORE:%.*]] = load i32, ptr [[STUFF]], align 4
; CHECK-NEXT: call void @test1f(ptr null)
; CHECK-NEXT: [[SUM:%.*]] = add i32 [[BEFORE]], [[BEFORE]]
; CHECK-NEXT: store i32 [[SUM]], ptr [[STUFF]], align 4
; CHECK-NEXT: ret void
;
%before = load i32, ptr %stuff
call void @test1f(ptr null)
%after = load i32, ptr %stuff ; <--- This should be a dead load
%sum = add i32 %before, %after
store i32 %sum, ptr %stuff
ret void
}