40 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2;3; Verify that wcslen calls with a constant argument of a nonintegral type4; of the same size as wchar_t or bigger doesn't cause trouble and is folded5; as expected.6;7; RUN: opt < %s -passes=instcombine -S | FileCheck %s8 9!llvm.module.flags = !{!0}10!0 = !{i32 1, !"wchar_size", i32 4}11 12declare i64 @wcslen(ptr)13 14@af = constant [2 x float] [float 0x3FF3B2FEC0000000, float 0.0]15 16; TODO: Fold wcslen(af) to a constant.17 18define i64 @fold_af() {19; CHECK-LABEL: @fold_af(20; CHECK-NEXT: [[N:%.*]] = call i64 @wcslen(ptr nonnull @af)21; CHECK-NEXT: ret i64 [[N]]22;23 %n = call i64 @wcslen(ptr @af)24 ret i64 %n25}26 27; TODO: Likewise, fold wcslen(as) to a constant.28 29%struct.S = type { i32 }30@aS = constant [3 x %struct.S] [%struct.S { i32 2 }, %struct.S { i32 1 }, %struct.S zeroinitializer]31 32define i64 @fold_aS() {33; CHECK-LABEL: @fold_aS(34; CHECK-NEXT: [[N:%.*]] = call i64 @wcslen(ptr nonnull @aS)35; CHECK-NEXT: ret i64 [[N]]36;37 %n = call i64 @wcslen(ptr @aS)38 ret i64 %n39}40