1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -memcpyopt -S -verify-memoryssa | FileCheck %s
4 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
6 define void @foo(i64* nocapture %P) {
9 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast i64* [[P:%.*]] to i16*
10 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i16, i16* [[TMP0]], i64 1
11 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i16* [[ARRAYIDX]] to i32*
12 ; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i16, i16* [[TMP0]], i64 3
13 ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i16* [[TMP0]] to i8*
14 ; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 2 [[TMP2]], i8 0, i64 8, i1 false)
15 ; CHECK-NEXT: ret void
18 %0 = bitcast i64* %P to i16*
19 %arrayidx = getelementptr inbounds i16, i16* %0, i64 1
20 %1 = bitcast i16* %arrayidx to i32*
21 %arrayidx1 = getelementptr inbounds i16, i16* %0, i64 3
22 store i16 0, i16* %0, align 2
23 store i32 0, i32* %1, align 4
24 store i16 0, i16* %arrayidx1, align 2