brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · b86066c Raw
75 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4; Memcpy is copying known-undef, and is thus removable5define void @test(ptr %dest) {6; CHECK-LABEL: @test(7; CHECK-NEXT:    ret void8;9  %a = alloca [7 x i8]10  call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %a, i64 7, i1 false)11  ret void12}13 14; Some non-undef elements15define void @test2(ptr %dest) {16; CHECK-LABEL: @test2(17; CHECK-NEXT:    [[A:%.*]] = alloca [7 x i8], align 118; CHECK-NEXT:    store i8 0, ptr [[A]], align 119; CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(7) [[DEST:%.*]], ptr noundef nonnull align 1 dereferenceable(7) [[A]], i64 7, i1 false)20; CHECK-NEXT:    ret void21;22  %a = alloca [7 x i8]23  store i8 0, ptr %a24  call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %a, i64 7, i1 false)25  ret void26}27 28; Volatile write is still required29define void @test3(ptr %dest) {30; CHECK-LABEL: @test3(31; CHECK-NEXT:    [[A:%.*]] = alloca [7 x i8], align 132; CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr [[DEST:%.*]], ptr [[A]], i64 7, i1 true)33; CHECK-NEXT:    ret void34;35  %a = alloca [7 x i8]36  call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %a, i64 7, i1 true)37  ret void38}39 40define void @test4(ptr %dest) {41; CHECK-LABEL: @test4(42; CHECK-NEXT:    ret void43;44  %a = alloca [7 x i8]45  call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %a, i64 7, i1 false)46  ret void47}48 49define void @test5(ptr %dest) {50; CHECK-LABEL: @test5(51; CHECK-NEXT:    ret void52;53  %a = alloca [7 x i8]54  %p2 = getelementptr i32, ptr %a, i32 155  call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %p2, i64 3, i1 false)56  ret void57}58 59define void @test6(ptr %dest) {60; CHECK-LABEL: @test6(61; CHECK-NEXT:    [[A:%.*]] = alloca [7 x i8], align 162; CHECK-NEXT:    [[P2:%.*]] = getelementptr inbounds nuw i8, ptr [[A]], i64 263; CHECK-NEXT:    store i16 42, ptr [[P2]], align 264; CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(7) [[DEST:%.*]], ptr noundef nonnull align 1 dereferenceable(7) [[P2]], i64 7, i1 false)65; CHECK-NEXT:    ret void66;67  %a = alloca [7 x i8]68  %p2 = getelementptr i16, ptr %a, i32 169  store i16 42, ptr %p270  call void @llvm.memcpy.p0.p0.i64(ptr %dest, ptr %p2, i64 7, i1 false)71  ret void72}73 74declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)75