[all-commits] [llvm/llvm-project] 8bca4e: [IRMover] Use signature for exact definition (#177...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Thu Jan 29 00:35:57 PST 2026
Branch: refs/heads/release/22.x
Home: https://github.com/llvm/llvm-project
Commit: 8bca4e53ac7f46d73103849208b20dcd1ce96655
https://github.com/llvm/llvm-project/commit/8bca4e53ac7f46d73103849208b20dcd1ce96655
Author: Nikita Popov <npopov at redhat.com>
Date: 2026-01-29 (Thu, 29 Jan 2026)
Changed paths:
M llvm/lib/Linker/IRMover.cpp
A llvm/test/Transforms/FunctionImport/Inputs/attr_fixup_dae_noundef.ll
A llvm/test/Transforms/FunctionImport/attr_fixup_dae_noundef.ll
Log Message:
-----------
[IRMover] Use signature for exact definition (#177381)
It is possible for optimizations to modify attributes on exact
definitions. In particular, DeadArgumentElimination may find that a
certain argument is dead, and replace arguments in calls with `poison`.
This requires dropping the `noundef` attribute on the argument.
When ThinLTO import is performed, the destination module already has a
declaration for the function, and the definition is not imported (e.g.
because it is noinline), we currently simply retain the original
declaration. This is incorrect if call with poison arguments were
imported, as the calls become immediate UB.
There was a previous attempt to address this in
https://reviews.llvm.org/D139209. What that patch did was to fix up the
attributes of the declaration after the fact, dropping UB implying
attributes that are not present on the definition. It was reverted
because it made an incorrect assumption that the signature between the
declaration and definition must match.
In this PR, I propose to fix the issue in a different way: If the source
module holds an exact definition (which are the ones that can be, in
limited ways, modified by optimizations), then even if we don't import
the definition, we should still import a declaration based on it. This
ensures that we respect any dropped attributes. (It's probably also
useful for optimization purposes, because we also see more inferred
attributes.)
Fixes https://github.com/llvm/llvm-project/issues/58976.
(cherry picked from commit f2deb793af7b9543180bba4b9402dcc7cc7a0c2e)
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