History log of /llvm-project/llvm/lib/Transforms/Utils/ModuleUtils.cpp (Results 1 – 25 of 96)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# b95ed30e 20-Jan-2025 Mats Larsen <mats@jun.codes>

[IR] Remove unused variables from #123617

Failed to notice them when landing that patch - apologies!


# 416f1c46 20-Jan-2025 Mats Jun Larsen <mats@jun.codes>

[IR] Replace of PointerType::get(Type) with opaque version (NFC) (#123617)

In accordance with https://github.com/llvm/llvm-project/issues/123569

In order to keep the patch at reasonable size, this

[IR] Replace of PointerType::get(Type) with opaque version (NFC) (#123617)

In accordance with https://github.com/llvm/llvm-project/issues/123569

In order to keep the patch at reasonable size, this PR only covers for
the llvm subproject, unittests excluded.

show more ...


Revision tags: llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4
# e1c36bde 20-Aug-2024 Sami Tolvanen <samitolvanen@users.noreply.github.com>

Fix KCFI types for generated functions with integer normalization (#104826)

With -fsanitize-cfi-icall-experimental-normalize-integers, Clang
appends ".normalized" to KCFI types in CodeGenModule::Cr

Fix KCFI types for generated functions with integer normalization (#104826)

With -fsanitize-cfi-icall-experimental-normalize-integers, Clang
appends ".normalized" to KCFI types in CodeGenModule::CreateKCFITypeId,
which changes type hashes also for functions that don't have integer
types in their signatures. However, llvm::setKCFIType does not take
integer normalization into account, which means LLVM generated
functions with KCFI types, e.g. sanitizer constructors, will fail KCFI
checks when integer normalization is enabled in Clang.

Add a cfi-normalize-integers module flag to indicate integer
normalization is used, and append ".normalized" to KCFI types also in
llvm::setKCFIType to fix the type mismatch.

show more ...


Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2
# 048cf885 02-Aug-2024 Vitaly Buka <vitalybuka@google.com>

[ModuleUtils] Add transformGlobal{C,D}tors (#101757)

For #101772


Revision tags: llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6
# 71fbbb69 15-May-2024 Nikita Popov <npopov@redhat.com>

[IR] Move GlobalValue::getGUID() out of line (NFC)

Avoid including MD5.h in a core IR header.


Revision tags: llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init
# 92289db8 17-Jan-2024 Alexandros Lamprineas <alexandros.lamprineas@arm.com>

[VFABI] Move the Vector ABI demangling utility to LLVMCore. (#77513)

This fixes #71892 allowing us to check magled names in the IR verifier.


# 7b83f69d 06-Dec-2023 Paschalis Mpeis <paschalis.mpeis@arm.com>

[NFC] Replace CallInst with FunctionType in VFABI, VFShape API (#74569)

Minor simplification applied to VFShape::getScalarShape,
VFShape::get, and VFABI::tryDemangleForVFABI methods.

Also, remov

[NFC] Replace CallInst with FunctionType in VFABI, VFShape API (#74569)

Minor simplification applied to VFShape::getScalarShape,
VFShape::get, and VFABI::tryDemangleForVFABI methods.

Also, remove unnecessary `static_cast` in `SLPVectorizer.cpp`

show more ...


Revision tags: llvmorg-17.0.6
# b1fba568 23-Nov-2023 Graham Hunter <graham.hunter@arm.com>

[SVE] Don't require lookup when demangling vector function mappings (#72260)

We can determine the VF from a combination of the mangled name (which
indicates the arguments that take vectors) and the

[SVE] Don't require lookup when demangling vector function mappings (#72260)

We can determine the VF from a combination of the mangled name (which
indicates the arguments that take vectors) and the element sizes of
the arguments for the scalar function the mapping has been established
for.

The assert when demangling fails has been removed in favour of just
not adding the mapping, which prevents the crash seen in
https://github.com/llvm/llvm-project/issues/71892

This patch also stops using _LLVM_ as an ISA for scalable vector tests,
since there aren't defined rules for the way vector arguments should be
handled (e.g. packed vs. unpacked representation).

show more ...


# aba04018 22-Nov-2023 Craig Topper <craig.topper@sifive.com>

[IR] Replace uses of IRBuilder::getInt8PtrTy with getPtrTy. NFC (#73154)


Revision tags: llvmorg-17.0.5
# 7b9d73c2 07-Nov-2023 Paulo Matos <pmatos@igalia.com>

[NFC] Remove Type::getInt8PtrTy (#71029)

Replace this with PointerType::getUnqual().
Followup to the opaque pointer transition. Fixes an in-code TODO item.


# 3ca4fe80 06-Nov-2023 Simon Pilgrim <llvm-dev@redking.me.uk>

[Transforms] Use StringRef::starts_with/ends_with instead of startswith/endswith. NFC.

startswith/endswith wrap starts_with/ends_with and will eventually go away (to more closely match string_view)


Revision tags: llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# 0d810937 14-Jul-2023 Nikita Popov <npopov@redhat.com>

[llvm] Remove calls to supportsTypedPointers() (NFC)

Always returns false now.


# 39d8e6e2 17-Jun-2023 Elliot Goodrich <elliotgoodrich@gmail.com>

Add missing StringExtras.h includes

In preparation for removing the `#include "llvm/ADT/StringExtras.h"`
from the header to source file of `llvm/Support/Error.h`, first add in
all the missing includ

Add missing StringExtras.h includes

In preparation for removing the `#include "llvm/ADT/StringExtras.h"`
from the header to source file of `llvm/Support/Error.h`, first add in
all the missing includes that were previously included transitively
through this header.

This is fixing all files missed in b0abd4893fa1.

Differential Revision: https://reviews.llvm.org/D154543

show more ...


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1
# b4307437 21-Mar-2023 Nikita Popov <npopov@redhat.com>

[ModuleUtils] Handle globals_ctors/dtors with non-literal type (PR56809)

If the global already exists, use its existing type, so we don't
try to mix literal and non-literal structs among the element

[ModuleUtils] Handle globals_ctors/dtors with non-literal type (PR56809)

If the global already exists, use its existing type, so we don't
try to mix literal and non-literal structs among the elements.

Fixes https://github.com/llvm/llvm-project/issues/56809.

show more ...


Revision tags: llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init
# 5265adc7 24-Jan-2023 Marco Elver <elver@google.com>

[SanitizerBinaryMetadata] Declare callbacks extern weak

Declare callbacks extern weak (if no existing declaration exists), and
only call if the function address is non-null.

This allows to attach s

[SanitizerBinaryMetadata] Declare callbacks extern weak

Declare callbacks extern weak (if no existing declaration exists), and
only call if the function address is non-null.

This allows to attach semantic metadata to binaries where no user of
that metadata exists, avoiding to have to link empty stub callbacks.

Once the binary is linked (statically or dynamically) against a tool
runtime that implements the callbacks, the respective callbacks will be
called. This vastly simplifies gradual deployment of tools using the
metadata, esp. avoiding having to recompile large codebases with
different compiler flags (which negatively impacts compiler caches).

Reviewed By: dvyukov, vitalybuka

Differential Revision: https://reviews.llvm.org/D142408

show more ...


Revision tags: llvmorg-15.0.7
# e7cd42f8 02-Dec-2022 Matt Arsenault <Matthew.Arsenault@amd.com>

Utils: Add utility pass to lower ifuncs

Create a global constructor which will initialize a global table of
function pointers. For now, this is only used as a reduction technique
for llvm-reduce.

I

Utils: Add utility pass to lower ifuncs

Create a global constructor which will initialize a global table of
function pointers. For now, this is only used as a reduction technique
for llvm-reduce.

In the future this may be useful to support ifunc on systems where the
program loader doesn't natively support it.

show more ...


# fd5e2627 11-Jan-2023 Sami Tolvanen <samitolvanen@google.com>

[ModuleUtils][KCFI] Set patchable-function-prefix for synthesized functions

When -fpatchable-function-entry is used to emit prefix nops
before functions, KCFI assumes all indirectly called functions

[ModuleUtils][KCFI] Set patchable-function-prefix for synthesized functions

When -fpatchable-function-entry is used to emit prefix nops
before functions, KCFI assumes all indirectly called functions
have the same number of prefix nops, because the nops are emitted
between the KCFI type hash and the function entry. However, as
patchable-function-prefix is a function attribute set by Clang,
functions later synthesized by LLVM don't inherit this attribute
and end up not having prefix nops. One of these functions
is asan.module_ctor, which the Linux kernel ends up calling
indirectly when KASAN is enabled.

In order to avoid tripping KCFI, save the expected prefix offset
to a module flag, and use it when we're setting KCFI type for the
relevant synthesized functions.

Link: https://github.com/ClangBuiltLinux/linux/issues/1742

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D141172

show more ...


# a78cfd59 06-Jan-2023 Sami Tolvanen <samitolvanen@google.com>

[GCOV] Set !kcfi_type metadata for indirectly called functions

With CONFIG_GCOV_KERNEL, the Linux kernel indirectly calls the
__llvm_gcov_* functions generated by LLVM. With -fsanitize=kcfi,
these c

[GCOV] Set !kcfi_type metadata for indirectly called functions

With CONFIG_GCOV_KERNEL, the Linux kernel indirectly calls the
__llvm_gcov_* functions generated by LLVM. With -fsanitize=kcfi,
these calls are made from instrumented code and fail indirect
call checks as they don't have !kcfi_type metadata. Similarly
to D138945, set type metadata for these functions to allow GCOV
and KCFI to be both enabled.

Link: https://github.com/ClangBuiltLinux/linux/issues/1778

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D141444

show more ...


# 38818b60 04-Jan-2023 serge-sans-paille <sguelton@mozilla.com>

Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ part

Use deduction guides instead of helper functions.

The only non-automatic changes have been:

1. ArrayRef(some_uint8_pointer, 0

Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ part

Use deduction guides instead of helper functions.

The only non-automatic changes have been:

1. ArrayRef(some_uint8_pointer, 0) needs to be changed into ArrayRef(some_uint8_pointer, (size_t)0) to avoid an ambiguous call with ArrayRef((uint8_t*), (uint8_t*))
2. CVSymbol sym(makeArrayRef(symStorage)); needed to be rewritten as CVSymbol sym{ArrayRef(symStorage)}; otherwise the compiler is confused and thinks we have a (bad) function prototype. There was a few similar situation across the codebase.
3. ADL doesn't seem to work the same for deduction-guides and functions, so at some point the llvm namespace must be explicitly stated.
4. The "reference mode" of makeArrayRef(ArrayRef<T> &) that acts as no-op is not supported (a constructor cannot achieve that).

Per reviewers' comment, some useless makeArrayRef have been removed in the process.

This is a follow-up to https://reviews.llvm.org/D140896 that introduced
the deduction guides.

Differential Revision: https://reviews.llvm.org/D140955

show more ...


# fb8eb84e 16-Dec-2022 Fangrui Song <i@maskray.me>

[Transforms,InstCombine] std::optional::value => operator*/operator->

value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavail

[Transforms,InstCombine] std::optional::value => operator*/operator->

value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).

show more ...


# aa9bdd50 09-Dec-2022 Matt Arsenault <Matthew.Arsenault@amd.com>

llvm-reduce: Fix invalid reductions with llvm.used

Fixes issue 59413.


# d4b6fcb3 14-Dec-2022 Fangrui Song <i@maskray.me>

[Analysis] llvm::Optional => std::optional


# 3b14862f 09-Dec-2022 Sami Tolvanen <samitolvanen@google.com>

[ModuleUtils][KCFI] Set !kcfi_type metadata for sanitizer constructors

Set KCFI type metadata for the sanitizer constructors to prevent
runtime failures when these functions are indirectly called in

[ModuleUtils][KCFI] Set !kcfi_type metadata for sanitizer constructors

Set KCFI type metadata for the sanitizer constructors to prevent
runtime failures when these functions are indirectly called in
instrumented code. This fixes a compatibility issue with KASAN and
-fsanitize=kcfi in the Linux kernel.

Link: https://github.com/ClangBuiltLinux/linux/issues/1742

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D138945

show more ...


# 02ea3694 29-Nov-2022 Matt Arsenault <Matthew.Arsenault@amd.com>

Utils: Fix appending to global_ctors with program address spaces

Also fix constructing sanitizer constructors in address space 0 so
it's testable (this was also failing the verifier on the type of
g

Utils: Fix appending to global_ctors with program address spaces

Also fix constructing sanitizer constructors in address space 0 so
it's testable (this was also failing the verifier on the type of
global_ctors).

show more ...


Revision tags: llvmorg-15.0.6
# a2f9ca88 28-Nov-2022 Matt Arsenault <Matthew.Arsenault@amd.com>

Utils: Use StringRef and rename variable for clarity


1234