llvm-project/clang/test/CodeGen/user-func-gnu-inline-redecl.c
serge-sans-paille 6bfc85c217 Fix inline builtin handling in case of redefinition
Basically, inline builtin definition are shadowed by externally visible
redefinition. This matches GCC behavior.

The implementation has to workaround the fact that:

1. inline builtin are renamed at callsite during codegen, but
2. they may be shadowed by a later external definition

As a consequence, during codegen, we need to walk redecls and eventually rewrite
some call sites, which is totally inelegant.

Differential Revision: https://reviews.llvm.org/D112059
2021-11-02 09:53:49 +01:00

21 lines
507 B
C

// RUN: %clang_cc1 -triple x86_64 -S -emit-llvm -O1 -o - %s | FileCheck %s
//
// Verifies that the gnu_inline version is ignored in favor of the redecl
extern inline __attribute__((gnu_inline)) unsigned long some_size(int c) {
return 1;
}
unsigned long mycall(int s) {
// CHECK-LABEL: i64 @mycall
// CHECK: ret i64 2
return some_size(s);
}
unsigned long some_size(int c) {
return 2;
}
unsigned long yourcall(int s) {
// CHECK-LABEL: i64 @yourcall
// CHECK: ret i64 2
return some_size(s);
}