llvm-project/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c
Joseph Huber 5a88dffc40
[Clang] Only define wchar_size module flag if non-standard (#184668)
Summary:
This PR simply changes the behavior of the `wchar_size` flag. Currently,
we emit this in all cases for all targets. This causes problems during
LLVM-IR linking, specifically because this would vary between Linux and
Windows in unintuitive ways. Now we have an llvm::Triple helper to
determine the size from the known values. The module flag will only be
emitted if these do not match (indicating a non-standard environment).

In addition to fixing AMDGCN bitcode linking, this also means we don't
need to bloat *every* IR module compiled by clang with this flag. The
changed tests reflects this, one less unnecessary piece of metadata.
2026-03-04 16:13:48 -06:00

21 lines
507 B
C

// RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \
// RUN: | FileCheck %s
//
// Test the emission of the "s390x-visible-vector-ABI" module flag.
// Call via global function pointer in internal function, with vector return
// value.
typedef __attribute__((vector_size(16))) int v4i32;
v4i32 (*bar)(int);
static int foo() {
return (*bar)(0)[0];
}
int fun() { return foo(); }
//CHECK: !llvm.module.flags = !{!0}
//CHECK: !0 = !{i32 2, !"s390x-visible-vector-ABI", i32 1}