44 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt < %s -S -passes=loop-idiom,loop-deletion | FileCheck %s3 4define [2 x i64] @convert_null_terminated_to_bounded_ptr(ptr noundef %p) {5; CHECK-LABEL: define [2 x i64] @convert_null_terminated_to_bounded_ptr(6; CHECK-SAME: ptr noundef [[P:%.*]]) {7; CHECK-NEXT: [[ENTRY:.*:]]8; CHECK-NEXT: [[WCSLEN:%.*]] = call i64 @wcslen(ptr [[P]])9; CHECK-NEXT: br label %[[TERMINATED_BY_LOOP_END:.*]]10; CHECK: [[TERMINATED_BY_LOOP_END]]:11; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, ptr [[P]], i64 [[WCSLEN]]12; CHECK-NEXT: [[TERMINATED_BY_UPPER:%.*]] = getelementptr i8, ptr [[TMP0]], i64 413; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P]] to i6414; CHECK-NEXT: [[DOTFCA_0_INSERT:%.*]] = insertvalue [2 x i64] poison, i64 [[TMP1]], 015; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TERMINATED_BY_UPPER]] to i6416; CHECK-NEXT: [[DOTFCA_1_INSERT:%.*]] = insertvalue [2 x i64] [[DOTFCA_0_INSERT]], i64 [[TMP2]], 117; CHECK-NEXT: ret [2 x i64] [[DOTFCA_1_INSERT]]18;19entry:20 br label %terminated_by.loop_cond21 22terminated_by.loop_cond: ; preds = %terminated_by.loop_cond, %entry23 %terminated_by.len.0 = phi i64 [ 0, %entry ], [ %terminated_by.new_len, %terminated_by.loop_cond ]24 %0 = getelementptr inbounds i32, ptr %p, i64 %terminated_by.len.025 %terminated_by.elem = load i32, ptr %0, align 426 %terminted_by.check_terminator = icmp eq i32 %terminated_by.elem, 027 %terminated_by.new_len = add i64 %terminated_by.len.0, 128 br i1 %terminted_by.check_terminator, label %terminated_by.loop_end, label %terminated_by.loop_cond29 30terminated_by.loop_end: ; preds = %terminated_by.loop_cond31 %1 = getelementptr inbounds i32, ptr %p, i64 %terminated_by.len.032 %terminated_by.upper = getelementptr i8, ptr %1, i64 433 %2 = ptrtoint ptr %p to i6434 %.fca.0.insert = insertvalue [2 x i64] poison, i64 %2, 035 %3 = ptrtoint ptr %terminated_by.upper to i6436 %.fca.1.insert = insertvalue [2 x i64] %.fca.0.insert, i64 %3, 137 ret [2 x i64] %.fca.1.insert38}39 40!llvm.module.flags = !{!0}41 42!0 = !{i32 1, !"wchar_size", i32 4}43 44