1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -S -passes='default<O3>' < %s | FileCheck %s
4 ; Make sure that interaction of "writable" with various passes does not
5 ; result in the elimination of the store prior to @j().
6 ; FIXME: This is a miscompile.
10 define void @j(ptr %p) optnone noinline {
11 ; CHECK-LABEL: define void @j(
12 ; CHECK-SAME: ptr [[P:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
13 ; CHECK-NEXT: [[I:%.*]] = load i64, ptr [[P]], align 4
14 ; CHECK-NEXT: call void @use(i64 [[I]])
15 ; CHECK-NEXT: ret void
18 call void @use(i64 %i)
22 define void @h(ptr %p) {
23 ; CHECK-LABEL: define void @h(
24 ; CHECK-SAME: ptr [[P:%.*]]) local_unnamed_addr {
25 ; CHECK-NEXT: store i64 3, ptr [[P]], align 4
26 ; CHECK-NEXT: tail call void @j(ptr nonnull [[P]])
27 ; CHECK-NEXT: ret void
34 define void @g(ptr dead_on_unwind noalias writable dereferenceable(8) align 8 %p) minsize {
35 ; CHECK-LABEL: define void @g(
36 ; CHECK-SAME: ptr dead_on_unwind noalias nocapture writable writeonly align 8 dereferenceable(8) [[P:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
37 ; CHECK-NEXT: tail call void @h(ptr nonnull [[P]])
38 ; CHECK-NEXT: ret void
42 call void @llvm.memcpy(ptr align 8 %p, ptr align 8 %a, i64 8, i1 false)
46 define void @f(ptr dead_on_unwind noalias %p) {
47 ; CHECK-LABEL: define void @f(
48 ; CHECK-SAME: ptr dead_on_unwind noalias [[P:%.*]]) local_unnamed_addr {
49 ; CHECK-NEXT: store i64 3, ptr [[P]], align 4
50 ; CHECK-NEXT: tail call void @j(ptr nonnull [[P]])
51 ; CHECK-NEXT: store i64 43, ptr [[P]], align 4
52 ; CHECK-NEXT: ret void