[ELF] MergeInputSection: replace Fatal with Err
[llvm-project.git] / clang / test / CodeGen / builtin-allow-runtime-check.cpp
blobdb3f59a9d48a1da59792dcee8fb8048f065a1f9a
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 4
2 // RUN: %clang_cc1 -cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
4 static_assert(__has_builtin(__builtin_allow_runtime_check), "");
6 // CHECK-LABEL: define dso_local noundef zeroext i1 @_Z4testv(
7 // CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
8 // CHECK-NEXT: entry:
9 // CHECK-NEXT: [[TMP0:%.*]] = call i1 @llvm.allow.runtime.check(metadata !"mycheck")
10 // CHECK-NEXT: ret i1 [[TMP0]]
12 bool test() {
13 return __builtin_allow_runtime_check("mycheck");
16 // CHECK-LABEL: define dso_local noundef zeroext i1 @_Z10test_twicev(
17 // CHECK-SAME: ) #[[ATTR0]] {
18 // CHECK-NEXT: entry:
19 // CHECK-NEXT: [[TMP0:%.*]] = call i1 @llvm.allow.runtime.check(metadata !"mycheck")
20 // CHECK-NEXT: [[CONV:%.*]] = zext i1 [[TMP0]] to i32
21 // CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.allow.runtime.check(metadata !"mycheck")
22 // CHECK-NEXT: [[CONV1:%.*]] = zext i1 [[TMP1]] to i32
23 // CHECK-NEXT: [[OR:%.*]] = or i32 [[CONV]], [[CONV1]]
24 // CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[OR]], 0
25 // CHECK-NEXT: ret i1 [[TOBOOL]]
27 bool test_twice() {
28 return __builtin_allow_runtime_check("mycheck") | __builtin_allow_runtime_check("mycheck");