[PATCH] D139209: [IRMover] Remove UB implying parameter attributes when necessary

Tim Neumann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 10:08:03 PST 2022


TimNN created this revision.
TimNN added a reviewer: tejohnson.
Herald added subscribers: jdoerfert, hiraditya.
Herald added a project: All.
TimNN published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When importing functions from some module X into some module Y, they may reference other functions already present in Y. The signature (especially attributes) of those other functions may have diverged between X and Y (e.g. due to the Dead Argument Elimination optimization). If necessary, modify the attributes to avoid UB.

See the added test and implementation comments for more details.

I'm not really familiar with this code, so please check if:

1. Is fixing the attributes during the import the correct approach?
2. Is this the correct location for fixing the attributes?
3. Is there a better way to implement the attribute removal?

This was exposed by https://reviews.llvm.org/D133036 before it was reverted. Fixes https://github.com/llvm/llvm-project/issues/58976.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139209

Files:
  llvm/include/llvm/IR/Attributes.h
  llvm/lib/Linker/IRMover.cpp
  llvm/test/Transforms/FunctionImport/Inputs/attr_fixup.ll
  llvm/test/Transforms/FunctionImport/attr_fixup.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139209.479669.patch
Type: text/x-patch
Size: 5850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221202/8e0eb075/attachment.bin>


More information about the llvm-commits mailing list