1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -S -passes=memcpyopt -verify-memoryssa | FileCheck %s 3 4target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" 5target triple = "armv7-eabi" 6 7%struct.qw = type { [4 x float] } 8%struct.bar = type { %struct.qw, %struct.qw, %struct.qw, %struct.qw, %struct.qw, float, float} 9 10; PR4882 11define void @test1(ptr %this) { 12; CHECK-LABEL: @test1( 13; CHECK-NEXT: entry: 14; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_BAR:%.*]], ptr [[THIS:%.*]], i32 0, i32 0, i32 0, i32 1 15; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 0, i32 0, i32 2 16; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 0, i32 0, i32 3 17; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 0 18; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 1 19; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 2 20; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 3 21; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 3, i32 0, i32 1 22; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 3, i32 0, i32 2 23; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 3, i32 0, i32 3 24; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 0 25; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 1 26; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 2 27; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 3 28; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 5 29; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[THIS]], i8 0, i64 32, i1 false) 30; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[TMP7]], i8 0, i64 32, i1 false) 31; CHECK-NEXT: unreachable 32; 33entry: 34 store float 0.000000e+00, ptr %this, align 4 35 %0 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 0, i32 0, i32 1 36 store float 0.000000e+00, ptr %0, align 4 37 %1 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 0, i32 0, i32 2 38 store float 0.000000e+00, ptr %1, align 4 39 %2 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 0, i32 0, i32 3 40 store float 0.000000e+00, ptr %2, align 4 41 %3 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 0 42 store float 0.000000e+00, ptr %3, align 4 43 %4 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 1 44 store float 0.000000e+00, ptr %4, align 4 45 %5 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 2 46 store float 0.000000e+00, ptr %5, align 4 47 %6 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 3 48 store float 0.000000e+00, ptr %6, align 4 49 %7 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 3, i32 0, i32 1 50 store float 0.000000e+00, ptr %7, align 4 51 %8 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 3, i32 0, i32 2 52 store float 0.000000e+00, ptr %8, align 4 53 %9 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 3, i32 0, i32 3 54 store float 0.000000e+00, ptr %9, align 4 55 %10 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 0 56 store float 0.000000e+00, ptr %10, align 4 57 %11 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 1 58 store float 0.000000e+00, ptr %11, align 4 59 %12 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 2 60 store float 0.000000e+00, ptr %12, align 4 61 %13 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 3 62 store float 0.000000e+00, ptr %13, align 4 63 %14 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 5 64 store float 0.000000e+00, ptr %14, align 4 65 unreachable 66} 67 68; PR8753 69 70declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind 71 72define void @test2(i32 %cmd) nounwind { 73; CHECK-LABEL: @test2( 74; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr null, ptr undef, i64 20, i1 false) #[[ATTR1:[0-9]+]] 75; CHECK-NEXT: ret void 76; 77 call void @llvm.memcpy.p0.p0.i64(ptr undef, ptr undef, i64 20, i1 false) nounwind 78 call void @llvm.memcpy.p0.p0.i64(ptr null, ptr undef, i64 20, i1 false) nounwind 79 ret void 80} 81 82; https://llvm.org/PR48075 83 84@g = external global i16, align 1 85 86define void @inttoptr_constexpr_crash(ptr %p) { 87; CHECK-LABEL: @inttoptr_constexpr_crash( 88; CHECK-NEXT: store <1 x ptr> inttoptr (<1 x i16> bitcast (<2 x i8> <i8 ptrtoint (ptr @g to i8), i8 ptrtoint (ptr @g to i8)> to <1 x i16>) to <1 x ptr>), ptr [[P:%.*]], align 1 89; CHECK-NEXT: ret void 90; 91 store <1 x ptr> inttoptr (<1 x i16> bitcast (<2 x i8> <i8 ptrtoint (ptr @g to i8), i8 ptrtoint (ptr @g to i8)> to <1 x i16>) to <1 x ptr>), ptr %p, align 1 92 ret void 93} 94