4 changes: 2 additions & 2 deletions llvm/test/Transforms/InstCombine/getelementptr.ll
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ define i32 @test27(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) {
; CHECK-NEXT: [[T349:%.*]] = getelementptr [[STRUCT_SIGINFO_T:%.*]], %struct.siginfo_t* [[T344]], i64 0, i32 3, i32 0, i32 3, i32 0
; CHECK-NEXT: [[T349350:%.*]] = bitcast i8** [[T349]] to i32*
; CHECK-NEXT: [[T351:%.*]] = load i32, i32* [[T349350]], align 8
; CHECK-NEXT: [[T360:%.*]] = call i32 asm sideeffect "...", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"(i32 [[T351]], %struct.__large_struct* elementtype([[STRUCT___LARGE_STRUCT:%.*]]) null, i32 -14, i32 0) #[[ATTR0:[0-9]+]]
; CHECK-NEXT: [[T360:%.*]] = call i32 asm sideeffect "...", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"(i32 [[T351]], %struct.__large_struct* elementtype(%struct.__large_struct) null, i32 -14, i32 0) #[[ATTR0:[0-9]+]]
; CHECK-NEXT: unreachable
;
entry:
Expand Down Expand Up @@ -1313,7 +1313,7 @@ define i8* @D98588(i8* %c1, i64 %offset) {
ret i8* %gep
}

declare noalias i8* @malloc(i64) nounwind
declare noalias i8* @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0)

define i32 @test_gep_bitcast_malloc(%struct.A* %a) {
; CHECK-LABEL: @test_gep_bitcast_malloc(
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Transforms/InstCombine/malloc-free-mismatched.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

define dso_local i32 @_Z6answeri(i32 %0) {
; CHECK-LABEL: @_Z6answeri(
; CHECK-NEXT: [[TMP2:%.*]] = call noalias nonnull dereferenceable(80) i8* @_Znam(i64 80) #[[ATTR1:[0-9]+]]
; CHECK-NEXT: [[TMP2:%.*]] = call noalias nonnull dereferenceable(80) i8* @_Znam(i64 80) #[[ATTR2:[0-9]+]]
; CHECK-NEXT: call void @free(i8* [[TMP2]])
; CHECK-NEXT: ret i32 42
;
Expand All @@ -24,7 +24,7 @@ define void @test_alloca() {
declare dso_local nonnull i8* @_Znam(i64) #1

; Function Attrs: nounwind
declare dso_local void @free(i8*)
declare dso_local void @free(i8*) allockind("free") "alloc-family"="malloc"

attributes #0 = { builtin allocsize(0) }
attributes #1 = { nobuiltin allocsize(0) }
attributes #1 = { nobuiltin allocsize(0) allockind("alloc,uninitialized") "alloc-family"="_Znam" }
8 changes: 4 additions & 4 deletions llvm/test/Transforms/InstCombine/malloc-free.ll
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ define i32 @dead_aligned_alloc(i32 %size, i32 %alignment, i8 %value) {
ret i32 0
}

declare noalias i8* @calloc(i32, i32) nounwind
declare noalias i8* @malloc(i32)
declare noalias i8* @aligned_alloc(i32, i32)
declare void @free(i8*)
declare noalias i8* @calloc(i32, i32) nounwind allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc"
declare noalias i8* @malloc(i32) allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc"
declare noalias i8* @aligned_alloc(i32, i32) allockind("alloc,uninitialized,aligned") allocsize(1) "alloc-family"="malloc"
declare void @free(i8*) allockind("free") "alloc-family"="malloc"

define i1 @foo() {
; CHECK-LABEL: @foo(
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/InstCombine/malloc_free_delete_nvptx.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
target triple = "nvptx64"

declare void @user(i8*)
declare i8* @malloc(i64)
declare void @free(i8*)
declare i8* @malloc(i64) allockind("alloc,uninitialized") "alloc-family"="malloc" allocsize(0)
declare void @free(i8*) allockind("free") "alloc-family"="malloc"

; Ensure the nvptx backend states malloc & free are a thing so we can recognize
; so we will optimize them properly. In the test below the malloc-free chain is
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/InstCombine/objsize-64.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
target datalayout = "e-p:64:64:64-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-s0:64:64-f80:128:128-n8:16:32:64-S128"

declare noalias i8* @malloc(i64) nounwind
declare noalias i8* @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0)
declare noalias nonnull i8* @_Znwm(i64) ; new(unsigned long)
declare i32 @__gxx_personality_v0(...)
declare void @__cxa_call_unexpected(i8*)
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/InstCombine/objsize.ll
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ entry:

declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind

declare noalias i8* @malloc(i32) nounwind
declare noalias i8* @malloc(i32) nounwind allockind("alloc,uninitialized") allocsize(0)

define i32 @test7(i8** %esc) {
; CHECK-LABEL: @test7(
Expand All @@ -207,7 +207,7 @@ define i32 @test7(i8** %esc) {
ret i32 %objsize
}

declare noalias i8* @calloc(i32, i32) nounwind
declare noalias i8* @calloc(i32, i32) nounwind allockind("alloc,zeroed") allocsize(0,1)

define i32 @test8(i8** %esc) {
; CHECK-LABEL: @test8(
Expand Down
11 changes: 6 additions & 5 deletions llvm/test/Transforms/InstCombine/realloc-free.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ define dso_local void @_Z3fooPv(i8* nocapture %0) local_unnamed_addr #0 {
; CHECK-NEXT: tail call void @free(i8* [[TMP0:%.*]])
; CHECK-NEXT: ret void
;
%2 = tail call align 16 dereferenceable_or_null(6) i8* @realloc(i8* %0, i64 6) #2
tail call void @free(i8* %2) #2
%2 = tail call align 16 dereferenceable_or_null(6) i8* @realloc(i8* %0, i64 6) #3
tail call void @free(i8* %2) #3
ret void
}

declare dso_local noalias noundef i8* @realloc(i8* nocapture, i64 noundef) local_unnamed_addr #1
declare dso_local void @free(i8* nocapture noundef) local_unnamed_addr #1
declare dso_local void @free(i8* nocapture noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nounwind uwtable willreturn }
attributes #1 = { inaccessiblemem_or_argmemonly mustprogress nounwind willreturn }
attributes #2 = { nounwind }
attributes #1 = { inaccessiblemem_or_argmemonly mustprogress nounwind willreturn allockind("realloc") }
attributes #2 = { inaccessiblemem_or_argmemonly mustprogress nounwind willreturn allockind("free") }
attributes #3 = { nounwind }
4 changes: 2 additions & 2 deletions llvm/test/Transforms/InstCombine/realloc.ll
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s

declare i8* @realloc(i8*, i64) #1
declare noalias i8* @malloc(i64) #1
declare i8* @realloc(i8* allocptr, i64) allockind("realloc") allocsize(1)
declare noalias i8* @malloc(i64) allockind("alloc,uninitialized")


define i8* @realloc_null_ptr() #0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

declare dso_local noalias noundef i8* @malloc(i64 noundef) local_unnamed_addr
declare dso_local noalias noundef i8* @malloc(i64 noundef) local_unnamed_addr allocsize(0)
declare i64 @llvm.objectsize.i64.p0i8(i8*, i1 immarg, i1 immarg, i1 immarg)

@buffer = dso_local global [4 x i8] zeroinitializer, align 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ define i64 @vla_pointer_size_mismatch(i42 %x) {
ret i64 %objsize
}

declare i8* @malloc(i64)
declare i8* @malloc(i64) allocsize(0)

define i64 @test_objectsize_malloc() {
; CHECK-LABEL: @test_objectsize_malloc(
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/MemCpyOpt/memcpy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ define void @test8() {
ret void
}

declare noalias i8* @malloc(i32) willreturn
declare noalias i8* @malloc(i32) willreturn allockind("alloc,uninitialized") allocsize(0)

; rdar://11341081
%struct.big = type { [50 x i32] }
Expand Down