[all-commits] [llvm/llvm-project] caa2a8: [MergeFunctions] Preserve symbols used llvm.used/l...

Amanieu via All-commits all-commits at lists.llvm.org
Thu Jun 16 13:36:54 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: caa2a829cdf905a5e8664d96a464d414b2adb42e
  Author: Amanieu d'Antras <amanieu at gmail.com>
  Date:   2022-06-16 (Thu, 16 Jun 2022)

  Changed paths:
    M llvm/lib/Transforms/IPO/MergeFunctions.cpp
    A llvm/test/Transforms/MergeFunc/merge-used.ll

  Log Message:
  [MergeFunctions] Preserve symbols used llvm.used/llvm.compiler.used

llvm.used and llvm.compiler.used are often used with inline assembly
that refers to a specific symbol so that the symbol is kept through to
the linker even though there are no references to it from LLVM IR.

This fixes the MergeFunctions pass to preserve references to these
symbols in llvm.used/llvm.compiler.used so they are not deleted from the
IR. This doesn't prevent these functions from being merged, but
guarantees that an alias or thunk with the expected symbol name is kept
in the IR.

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

More information about the All-commits mailing list