1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -memcpyopt < %s -verify-memoryssa | FileCheck %s
3 declare void @may_throw(i32* nocapture %x)
5 define void @test1(i32* nocapture noalias dereferenceable(4) %x) {
8 ; CHECK-NEXT: [[T:%.*]] = alloca i32, align 4
9 ; CHECK-NEXT: call void @may_throw(i32* nonnull [[T]])
10 ; CHECK-NEXT: [[LOAD:%.*]] = load i32, i32* [[T]], align 4
11 ; CHECK-NEXT: store i32 [[LOAD]], i32* [[X:%.*]], align 4
12 ; CHECK-NEXT: ret void
15 %t = alloca i32, align 4
16 call void @may_throw(i32* nonnull %t)
17 %load = load i32, i32* %t, align 4
18 store i32 %load, i32* %x, align 4
22 declare void @always_throws()
24 define void @test2(i32* nocapture noalias dereferenceable(4) %x) {
25 ; CHECK-LABEL: @test2(
27 ; CHECK-NEXT: [[T:%.*]] = alloca i32, align 4
28 ; CHECK-NEXT: call void @may_throw(i32* nonnull [[T]]) [[ATTR0:#.*]]
29 ; CHECK-NEXT: [[LOAD:%.*]] = load i32, i32* [[T]], align 4
30 ; CHECK-NEXT: call void @always_throws()
31 ; CHECK-NEXT: store i32 [[LOAD]], i32* [[X:%.*]], align 4
32 ; CHECK-NEXT: ret void
35 %t = alloca i32, align 4
36 call void @may_throw(i32* nonnull %t) nounwind
37 %load = load i32, i32* %t, align 4
38 call void @always_throws()
39 store i32 %load, i32* %x, align 4