xref: /llvm-project/llvm/test/Transforms/InstCombine/wcslen-4.ll (revision cbbf1ebb7027940d5aa78646d2ff644c7e864983)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; Test that the wcslen library call simplifier works correctly.
3;
4; RUN: opt < %s -passes=instcombine -S | FileCheck %s
5
6target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
7
8; Without the wchar_size metadata we should see no optimization happening.
9
10@hello = constant [6 x i32] [i32 104, i32 101, i32 108, i32 108, i32 111, i32 0]
11
12declare i64 @wcslen(ptr)
13
14define i64 @test_no_simplify1() {
15; CHECK-LABEL: @test_no_simplify1(
16; CHECK-NEXT:    [[HELLO_L:%.*]] = call i64 @wcslen(ptr nonnull @hello)
17; CHECK-NEXT:    ret i64 [[HELLO_L]]
18;
19  %hello_l = call i64 @wcslen(ptr @hello)
20  ret i64 %hello_l
21}
22