brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 5f31d78 Raw
54 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4define dso_local i32 @_Z6answeri(i32 %0) {5; CHECK-LABEL: @_Z6answeri(6; CHECK-NEXT:    [[TMP2:%.*]] = call noalias nonnull dereferenceable(80) ptr @_Znam(i64 80) #[[ATTR4:[0-9]+]]7; CHECK-NEXT:    call void @free(ptr [[TMP2]])8; CHECK-NEXT:    ret i32 429;10  %2 = call noalias nonnull ptr @_Znam(i64 80) #011  call void @free(ptr %2)12  ret i32 4213}14 15; All we care about with this function is that LLVM doesn't crash16; when optimizing it.17define void @test_alloca() {18; CHECK-LABEL: @test_alloca(19; CHECK-NEXT:    [[TMP1:%.*]] = alloca i8, align 120; CHECK-NEXT:    call void @free(ptr [[TMP1]])21; CHECK-NEXT:    ret void22;23  %1 = alloca i824  call void @free(ptr %1)25  ret void26}27 28; Test that missing `alloc-family` attributes don't crash LLVM29; https://github.com/llvm/llvm-project/issues/6374930 31define void @no_family() {32; CHECK-LABEL: @no_family(33; CHECK-NEXT:       [[ALLOC:%.*]] = call ptr @customalloc(i64 64)34; CHECK-NEXT:       call void @customfree(ptr [[ALLOC]])35; CHECK-NEXT:       ret void36;37  %alloc = call ptr @customalloc(i64 64)38  call void @customfree(ptr %alloc)39  ret void40}41 42 43; Function Attrs: nobuiltin allocsize(0)44declare dso_local nonnull ptr @_Znam(i64) #145 46; Function Attrs: nounwind47declare dso_local void @free(ptr) allockind("free") "alloc-family"="malloc"48 49declare ptr @customalloc(i64) allockind("alloc")50declare void @customfree(ptr allocptr) allockind("free")51 52attributes #0 = { builtin allocsize(0) }53attributes #1 = { nobuiltin allocsize(0) allockind("alloc,uninitialized") "alloc-family"="_Znam" }54