[all-commits] [llvm/llvm-project] 9ad72d: [clang] Use different memory layout type for _BitI...
Mariya Podchishchaeva via All-commits
all-commits at lists.llvm.org
Mon Jul 15 00:41:00 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9ad72df55cb74b29193270c28f6974d2af8e0b71
https://github.com/llvm/llvm-project/commit/9ad72df55cb74b29193270c28f6974d2af8e0b71
Author: Mariya Podchishchaeva <mariya.podchishchaeva at intel.com>
Date: 2024-07-15 (Mon, 15 Jul 2024)
Changed paths:
M clang/lib/CodeGen/CGCall.cpp
M clang/lib/CodeGen/CGDecl.cpp
M clang/lib/CodeGen/CGExpr.cpp
M clang/lib/CodeGen/CGExprConstant.cpp
M clang/lib/CodeGen/CGExprScalar.cpp
M clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
M clang/lib/CodeGen/CGStmt.cpp
M clang/lib/CodeGen/CodeGenFunction.cpp
M clang/lib/CodeGen/CodeGenFunction.h
M clang/lib/CodeGen/CodeGenTypes.cpp
M clang/lib/CodeGen/CodeGenTypes.h
M clang/test/CodeGen/aarch64-byval-temp.c
M clang/test/CodeGen/attr-noundef.cpp
M clang/test/CodeGen/builtins-bitint.c
M clang/test/CodeGen/builtins-elementwise-math.c
M clang/test/CodeGen/builtins-overflow.c
M clang/test/CodeGen/ext-int-cc.c
M clang/test/CodeGen/ext-int-sanitizer.cpp
M clang/test/CodeGen/ext-int.c
M clang/test/CodeGen/extend-arg-64.c
M clang/test/CodeGen/ubsan-shift-bitint.c
M clang/test/CodeGenCXX/ext-int.cpp
M clang/test/CodeGenHIP/printf_nonhostcall.cpp
M clang/test/CodeGenHLSL/builtins/dot-builtin.hlsl
M clang/test/Frontend/fixed_point_comparisons.c
M clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
M clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
M clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
M clang/test/OpenMP/target_teams_generic_loop_if_codegen.cpp
M clang/test/OpenMP/teams_distribute_parallel_for_if_codegen.cpp
M clang/test/OpenMP/teams_distribute_parallel_for_simd_if_codegen.cpp
M clang/test/OpenMP/teams_distribute_simd_codegen.cpp
Log Message:
-----------
[clang] Use different memory layout type for _BitInt(N) in LLVM IR (#91364)
There are two problems with _BitInt prior to this patch:
1. For at least some values of N, we cannot use LLVM's iN for the type
of struct elements, array elements, allocas, global variables, and so
on, because the LLVM layout for that type does not match the high-level
layout of _BitInt(N).
Example: Currently for i128:128 targets correct implementation is
possible either for __int128 or for _BitInt(129+) with lowering to iN,
but not both, since we have now correct implementation of __int128 in
place after a21abc7.
When this happens, opaque [M x i8] types used, where M =
sizeof(_BitInt(N)).
2. LLVM doesn't guarantee any particular extension behavior for integer
types that aren't a multiple of 8. For this reason, all _BitInt types
are now have in-memory representation that is a whole number of bytes.
I.e. for example _BitInt(17) now will have memory layout type i32.
This patch also introduces concept of load/store type and adds an API to
CodeGenTypes that returns the IR type that should be used for load and
store operations. This is particularly useful for the case when a
_BitInt ends up having array of bytes as memory layout type. For
_BitInt(N), let M = sizeof(_BitInt(N)), and let BITS = M * 8. Loads and
stores of iM would both (1) produce far better code from the backends
and (2) be far more optimizable by IR passes than loads and stores of [M
x i8].
Fixes https://github.com/llvm/llvm-project/issues/85139
Fixes https://github.com/llvm/llvm-project/issues/83419
---------
Co-authored-by: John McCall <rjmccall at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list