[AArch64][NFC] NFC for const vector as Instruction operand (#116790)
[llvm-project.git] / llvm / test / Transforms / InstCombine / builtin-object-size-strdup-family.ll
blob63f3edc20c0f3c9b0f768993eaf417e66038d49f
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=instcombine -S < %s | FileCheck %s
5 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 declare dso_local noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr
9 declare i64 @llvm.objectsize.i64.p0(ptr, i1 immarg, i1 immarg, i1 immarg)
10 declare noalias ptr @strdup(ptr);
11 declare noalias ptr @__strdup(ptr);
12 declare noalias ptr @strndup(ptr, i64);
13 declare noalias ptr @__strndup(ptr, i64);
15 @str = dso_local constant [11 x i8] c"toulbroc'h\00"
17 define dso_local i64 @check_strdup(i32 noundef %n) local_unnamed_addr {
18 ; CHECK-LABEL: @check_strdup(
19 ; CHECK-NEXT:    ret i64 11
21   %ptr = call noalias ptr @strdup(ptr noundef @str)
22   %size = call i64 @llvm.objectsize.i64.p0(ptr %ptr, i1 false, i1 true, i1 false)
23   ret i64 %size
26 define dso_local i64 @check_dunder_strdup(i32 noundef %n) local_unnamed_addr {
27 ; CHECK-LABEL: @check_dunder_strdup(
28 ; CHECK-NEXT:    ret i64 11
30   %ptr = call noalias ptr @__strdup(ptr noundef @str)
31   %size = call i64 @llvm.objectsize.i64.p0(ptr %ptr, i1 false, i1 true, i1 false)
32   ret i64 %size
35 define dso_local i64 @check_strndup(i32 noundef %n) local_unnamed_addr {
36 ; CHECK-LABEL: @check_strndup(
37 ; CHECK-NEXT:    ret i64 5
39   %ptr = call noalias ptr @strndup(ptr noundef @str, i64 4)
40   %size = call i64 @llvm.objectsize.i64.p0(ptr %ptr, i1 false, i1 true, i1 false)
41   ret i64 %size
44 define dso_local i64 @check_dunder_strndup(i32 noundef %n) local_unnamed_addr {
45 ; CHECK-LABEL: @check_dunder_strndup(
46 ; CHECK-NEXT:    ret i64 5
48   %ptr = call noalias ptr @__strndup(ptr noundef @str, i64 4)
49   %size = call i64 @llvm.objectsize.i64.p0(ptr %ptr, i1 false, i1 true, i1 false)
50   ret i64 %size