74 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22 3; RUN: opt -O3 -S < %s | FileCheck %s4 5define internal i32 @loop(ptr %arg, ptr %arg1) {6bb:7 br label %bb28 9bb2:10 %phi = phi ptr [ %arg, %bb ], [ %phi8, %bb11 ]11 %phi3 = phi i32 [ 0, %bb ], [ %add, %bb11 ]12 %icmp = icmp ne ptr %arg1, null13 %icmp4 = icmp eq ptr %phi, %arg114 br i1 %icmp4, label %bb7, label %bb515 16bb5:17 %getelementptr = getelementptr inbounds i32, ptr %phi, i64 118 br label %bb719 20bb7:21 %phi8 = phi ptr [ %phi, %bb2 ], [ %getelementptr, %bb5 ]22 %phi9 = phi ptr [ null, %bb2 ], [ %phi, %bb5 ]23 %icmp10 = icmp eq ptr %phi9, null24 br i1 %icmp10, label %bb12, label %bb1125 26bb11:27 %load = load i32, ptr %phi9, align 428 %add = add i32 %load, %phi329 br label %bb230 31bb12:32 ret i32 %phi333}34 35define i32 @using_alloca() {36; CHECK-LABEL: define noundef i32 @using_alloca37; CHECK-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] {38; CHECK-NEXT: bb:39; CHECK-NEXT: ret i32 640;41bb:42 %alloca = alloca [3 x i32], align 443 store i32 1, ptr %alloca, align 444 %getelementptr = getelementptr i32, ptr %alloca, i32 145 store i32 2, ptr %getelementptr, align 446 %getelementptr1 = getelementptr i32, ptr %alloca, i32 247 store i32 3, ptr %getelementptr1, align 448 %getelementptr2 = getelementptr i32, ptr %alloca, i32 349 %call = call i32 @loop(ptr %alloca, ptr %getelementptr2)50 ret i32 %call51}52 53define i32 @using_malloc() {54; CHECK-LABEL: define noundef i32 @using_malloc55; CHECK-SAME: () local_unnamed_addr #[[ATTR0]] {56; CHECK-NEXT: bb:57; CHECK-NEXT: ret i32 658;59bb:60 %alloc = call dereferenceable_or_null(64) ptr @malloc(i64 64)61 store i32 1, ptr %alloc, align 462 %getelementptr = getelementptr i32, ptr %alloc, i64 163 store i32 2, ptr %getelementptr, align 464 %getelementptr1 = getelementptr i32, ptr %alloc, i64 265 store i32 3, ptr %getelementptr1, align 466 %getelementptr2 = getelementptr i32, ptr %alloc, i64 367 %call = call i32 @loop(ptr %alloc, ptr %getelementptr2)68 ret i32 %call69}70 71declare ptr @malloc(i64)72 73declare void @free(ptr)74