1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt < %s -passes=newgvn -S | FileCheck %s
5 declare void @test1f(ptr)
7 define void @test1(ptr noalias %stuff ) {
8 ; CHECK-LABEL: define void @test1(
9 ; CHECK-SAME: ptr noalias [[STUFF:%.*]]) {
10 ; CHECK-NEXT: [[BEFORE:%.*]] = load i32, ptr [[STUFF]], align 4
11 ; CHECK-NEXT: call void @test1f(ptr null)
12 ; CHECK-NEXT: [[SUM:%.*]] = add i32 [[BEFORE]], [[BEFORE]]
13 ; CHECK-NEXT: store i32 [[SUM]], ptr [[STUFF]], align 4
14 ; CHECK-NEXT: ret void
16 %before = load i32, ptr %stuff
18 call void @test1f(ptr null)
20 %after = load i32, ptr %stuff ; <--- This should be a dead load
21 %sum = add i32 %before, %after
23 store i32 %sum, ptr %stuff