brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 24c9a32 Raw
59 lines · c
1// RUN: %clang_cc1 -triple x86_64 -fclangir -emit-cir -disable-llvm-passes -o %t-cir.cir %s2// RUN: FileCheck --input-file=%t-cir.cir %s --check-prefix=CIR3// RUN: %clang_cc1 -triple x86_64 -fclangir -emit-llvm -disable-llvm-passes -o %t-cir.ll %s4// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM5// RUN: %clang_cc1 -triple x86_64 -emit-llvm -disable-llvm-passes -o %t.ll %s6// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG7 8 9// Verifies that clang-generated *.inline carry the same name at call and callee10// site, in spite of asm labels.11 12typedef struct _IO_FILE FILE;13extern FILE *stdout;14extern int vprintf (const char *__restrict __format, __builtin_va_list __arg);15extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,16      const char *__restrict __format, __builtin_va_list __ap);17extern int __vprintf_chk (int __flag, const char *__restrict __format,18     __builtin_va_list __ap);19 20extern __typeof (vprintf) vprintf __asm ("__vprintfieee128");21extern __typeof (__vfprintf_chk) __vfprintf_chk __asm ("__vfprintf_chkieee128");22extern __typeof (__vprintf_chk) __vprintf_chk __asm ("__vprintf_chkieee128");23 24extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) int25vprintf (const char *__restrict __fmt, __builtin_va_list __ap)26{27  return __vfprintf_chk (stdout, 2 - 1, __fmt, __ap);28}29 30void test(const char *fmt, __builtin_va_list ap) {31  vprintf(fmt, ap);32}33 34// CIR: cir.func internal private @__vprintfieee128.inline({{.*}}) -> !s32i inline(always)35// CIR:   cir.call @__vfprintf_chkieee128(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}})36//37// CIR: cir.func {{.*}} @test({{.*}})38// CIR:   cir.call @__vprintfieee128.inline(%{{.*}}, %{{.*}})39 40 41// LLVM: define internal i32 @__vprintfieee128.inline({{.*}}) #[[ALWAYS_INLINE_ATTR:.*]] {42// LLVM:   call i32 @__vfprintf_chkieee128(ptr %{{.*}}, i32 1, ptr %{{.*}}, ptr %{{.*}})43//44// LLVM: define {{.*}} void @test{{.*}}45// LLVM:   call i32 @__vprintfieee128.inline(ptr %{{.*}}, ptr %{{.*}})46//47// LLVM: attributes #[[ALWAYS_INLINE_ATTR]] = { alwaysinline }48 49// Note: OGCG emits these in the opposite order, but the content is the same.50 51 52// OGCG: define {{.*}} void @test{{.*}}53// OGCG:   call i32 @__vprintfieee128.inline(ptr noundef %{{.*}}, ptr noundef %{{.*}})54//55// OGCG: define internal i32 @__vprintfieee128.inline({{.*}}) #[[ALWAYS_INLINE_ATTR:.*]] {56// OGCG:   call i32 @__vfprintf_chkieee128(ptr noundef %{{.*}}, i32 noundef 1, ptr noundef %{{.*}}, ptr noundef %{{.*}})57//58// OGCG: attributes #[[ALWAYS_INLINE_ATTR]] = { alwaysinline {{.*}} }59