• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instcombine -S | FileCheck %s
3
4declare i8* @realloc(i8*, i64) #1
5declare noalias i8* @malloc(i64) #1
6
7
8define i8* @realloc_null_ptr() #0 {
9; CHECK-LABEL: @realloc_null_ptr(
10; CHECK-NEXT:    [[MALLOC:%.*]] = call dereferenceable_or_null(100) i8* @malloc(i64 100)
11; CHECK-NEXT:    ret i8* [[MALLOC]]
12;
13  %call = call i8* @realloc(i8* null, i64 100) #2
14  ret i8* %call
15}
16
17define i8* @realloc_unknown_ptr(i8* %ptr) #0 {
18; CHECK-LABEL: @realloc_unknown_ptr(
19; CHECK-NEXT:    [[CALL:%.*]] = call dereferenceable_or_null(100) i8* @realloc(i8* [[PTR:%.*]], i64 100)
20; CHECK-NEXT:    ret i8* [[CALL]]
21;
22  %call = call i8* @realloc(i8* %ptr, i64 100) #2
23  ret i8* %call
24}
25