1- ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1+ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
22; Test that the strncpy library call simplifier works correctly.
33;
44; RUN: opt < %s -passes=instcombine -S | FileCheck %s
@@ -16,6 +16,16 @@ declare i32 @puts(ptr)
1616
1717; Check a bunch of strncpy invocations together.
1818
19+ ;.
20+ ; CHECK: @hello = constant [6 x i8] c"hello\00"
21+ ; CHECK: @null = constant [1 x i8] zeroinitializer
22+ ; CHECK: @null_hello = constant [7 x i8] c"\00hello\00"
23+ ; CHECK: @a = common global [32 x i8] zeroinitializer, align 1
24+ ; CHECK: @b = common global [32 x i8] zeroinitializer, align 1
25+ ; CHECK: @str = private unnamed_addr constant [32 x i8] c"hello\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", align 1
26+ ; CHECK: @str.1 = private unnamed_addr constant [32 x i8] c"hello\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", align 1
27+ ; CHECK: @str.2 = private unnamed_addr constant [8 x i8] c"hello\00\00\00", align 1
28+ ;.
1929define i32 @test_simplify1 () {
2030; CHECK-LABEL: @test_simplify1(
2131; CHECK-NEXT: [[TARGET:%.*]] = alloca [1024 x i8], align 1
@@ -197,3 +207,7 @@ define void @test_no_incompatible_attr() {
197207 call ptr @strncpy (ptr @a , ptr @hello , i32 6 )
198208 ret void
199209}
210+ ;.
211+ ; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
212+ ; CHECK: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: write) }
213+ ;.
0 commit comments