Files
clang-p2996/llvm/test/Transforms/InstCombine/realloc.ll
Augie Fackler 12c0bf8ba9 tests: add attributes that would normally come from inferattrs
As my goal is to remove at least _some_ functions from the static list
in MemoryBuiltins.cpp, these tests either need to run inferattrs or
statically declare these attributes to keep passing. A couple of tests
had alternate cases which are no longer meaningful, e.g.
`malloc-load-removal.ll`.

Differential Revision: https://reviews.llvm.org/D123087
2022-07-25 17:29:00 -04:00

25 lines
830 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
declare i8* @realloc(i8* allocptr, i64) allockind("realloc") allocsize(1)
declare noalias i8* @malloc(i64) allockind("alloc,uninitialized")
define i8* @realloc_null_ptr() #0 {
; CHECK-LABEL: @realloc_null_ptr(
; CHECK-NEXT: [[MALLOC:%.*]] = call dereferenceable_or_null(100) i8* @malloc(i64 100)
; CHECK-NEXT: ret i8* [[MALLOC]]
;
%call = call i8* @realloc(i8* null, i64 100) #2
ret i8* %call
}
define i8* @realloc_unknown_ptr(i8* %ptr) #0 {
; CHECK-LABEL: @realloc_unknown_ptr(
; CHECK-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(100) i8* @realloc(i8* [[PTR:%.*]], i64 100)
; CHECK-NEXT: ret i8* [[CALL]]
;
%call = call i8* @realloc(i8* %ptr, i64 100) #2
ret i8* %call
}