Files
clang-p2996/clang/test/CodeGen/wmemchr.c
Nikita Popov 532dc62b90 [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC)
This adds -no-opaque-pointers to clang tests whose output will
change when opaque pointers are enabled by default. This is
intended to be part of the migration approach described in
https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322/9.

The patch has been produced by replacing %clang_cc1 with
%clang_cc1 -no-opaque-pointers for tests that fail with opaque
pointers enabled. Worth noting that this doesn't cover all tests,
there's a remaining ~40 tests not using %clang_cc1 that will need
a followup change.

Differential Revision: https://reviews.llvm.org/D123115
2022-04-07 12:09:47 +02:00

33 lines
1.3 KiB
C

// RUN: %clang_cc1 -no-opaque-pointers %s -triple x86_64-pc-win32 -emit-llvm -o - | FileCheck %s
typedef __SIZE_TYPE__ size_t;
typedef __WCHAR_TYPE__ wchar_t;
const wchar_t *wmemchr_test(const wchar_t *s, const wchar_t c, size_t n) {
// CHECK-LABEL: define dso_local i16* @wmemchr_test
// CHECK: [[S:%.*]] = load
// CHECK: [[C:%.*]] = load
// CHECK: [[N:%.*]] = load
// CHECK: [[N0:%.*]] = icmp eq i64 [[N]], 0
// CHECK: br i1 [[N0]], label %[[EXIT:.*]], label %[[EQ:.*]]
// CHECK: [[EQ]]:
// CHECK: [[SP:%.*]] = phi i16* [ [[S]], %[[ENTRY:.*]] ], [ [[SN:.*]], %[[NEXT:.*]] ]
// CHECK: [[NP:%.*]] = phi i64 [ [[N]], %[[ENTRY]] ], [ [[NN:.*]], %[[NEXT]] ]
// CHECK: [[SL:%.*]] = load i16, i16* [[SP]], align 2
// CHECK: [[RES:%.*]] = getelementptr inbounds i16, i16* [[SP]], i32 0
// CHECK: [[CMPEQ:%.*]] = icmp eq i16 [[SL]], [[C]]
// CHECK: br i1 [[CMPEQ]], label %[[EXIT]], label %[[LT:.*]]
// CHECK: [[NEXT]]:
// CHECK: [[SN]] = getelementptr inbounds i16, i16* [[SP]], i32 1
// CHECK: [[NN]] = sub i64 [[NP]], 1
// CHECK: [[NN0:%.*]] = icmp eq i64 [[NN]], 0
// CHECK: br i1 [[NN0]], label %[[EXIT]], label %[[EQ]]
//
// CHECK: [[EXIT]]:
// CHECK: [[RV:%.*]] = phi i16* [ null, %[[ENTRY]] ], [ null, %[[NEXT]] ], [ [[RES]], %[[EQ]] ]
// CHECK: ret i16* [[RV]]
return __builtin_wmemchr(s, c, n);
}