94 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -S -passes=memcpyopt -verify-memoryssa | FileCheck %s3 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; PR488211define 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 115; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 0, i32 0, i32 216; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 0, i32 0, i32 317; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 018; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 119; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 220; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 1, i32 0, i32 321; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 3, i32 0, i32 122; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 3, i32 0, i32 223; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 3, i32 0, i32 324; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 025; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 126; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 227; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 4, i32 0, i32 328; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT_BAR]], ptr [[THIS]], i32 0, i32 529; 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: unreachable32;33entry:34 store float 0.000000e+00, ptr %this, align 435 %0 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 0, i32 0, i32 136 store float 0.000000e+00, ptr %0, align 437 %1 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 0, i32 0, i32 238 store float 0.000000e+00, ptr %1, align 439 %2 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 0, i32 0, i32 340 store float 0.000000e+00, ptr %2, align 441 %3 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 042 store float 0.000000e+00, ptr %3, align 443 %4 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 144 store float 0.000000e+00, ptr %4, align 445 %5 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 246 store float 0.000000e+00, ptr %5, align 447 %6 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 1, i32 0, i32 348 store float 0.000000e+00, ptr %6, align 449 %7 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 3, i32 0, i32 150 store float 0.000000e+00, ptr %7, align 451 %8 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 3, i32 0, i32 252 store float 0.000000e+00, ptr %8, align 453 %9 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 3, i32 0, i32 354 store float 0.000000e+00, ptr %9, align 455 %10 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 056 store float 0.000000e+00, ptr %10, align 457 %11 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 158 store float 0.000000e+00, ptr %11, align 459 %12 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 260 store float 0.000000e+00, ptr %12, align 461 %13 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 4, i32 0, i32 362 store float 0.000000e+00, ptr %13, align 463 %14 = getelementptr inbounds %struct.bar, ptr %this, i32 0, i32 564 store float 0.000000e+00, ptr %14, align 465 unreachable66}67 68; PR875369 70declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind71 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 void76;77 call void @llvm.memcpy.p0.p0.i64(ptr undef, ptr undef, i64 20, i1 false) nounwind78 call void @llvm.memcpy.p0.p0.i64(ptr null, ptr undef, i64 20, i1 false) nounwind79 ret void80}81 82; https://llvm.org/PR4807583 84@g = external global i16, align 185 86define void @inttoptr_constexpr_crash(ptr %p) {87; CHECK-LABEL: @inttoptr_constexpr_crash(88; CHECK-NEXT: store <1 x ptr> <ptr inttoptr (i16 extractelement (<1 x i16> bitcast (<2 x i8> <i8 ptrtoint (ptr @g to i8), i8 ptrtoint (ptr @g to i8)> to <1 x i16>), i32 0) to ptr)>, ptr [[P:%.*]], align 189; CHECK-NEXT: ret void90;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 192 ret void93}94