[all-commits] [llvm/llvm-project] b67c16: Verifier: Disallow uses of intrinsic global variables

Matt Arsenault via All-commits all-commits at lists.llvm.org
Thu Jan 5 11:51:51 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b67c16ff6af557174e498d6d82df9936e333f3d6
      https://github.com/llvm/llvm-project/commit/b67c16ff6af557174e498d6d82df9936e333f3d6
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2023-01-05 (Thu, 05 Jan 2023)

  Changed paths:
    M llvm/lib/IR/Verifier.cpp
    A llvm/test/Linker/Inputs/funcimport_appending_global_used.ll
    A llvm/test/Linker/funcimport_appending_global_used.ll
    A llvm/test/Verifier/global-ctors-dtors-uses.ll
    A llvm/test/Verifier/used-uses.ll

  Log Message:
  -----------
  Verifier: Disallow uses of intrinsic global variables

appendToGlobalCtors implicitly assumes this is the case, since it
deletes and recreates without trying to update any uses.

This ran into an interesting problem in a few linker tests. During the
link, ConstantExpr casts were speculatively created to replace any
uses that might need them for replacement. These unused ConstantExprs
would hang around and still appear on the use list. It seems like a
bug that those stick around, but I'm not sure where those are supposed
to be cleaned up. Avoid this by not creating the casts for appending
linkage.

Delete one of the casts entirely as it breaks no tests. The verifier
has enforced a specific type for these since 2011, so I don't see why
we would need to handle linking modules with a wrong types. One test
does fail without the second cast (Linker/appending-global-proto.ll,
added by D95126). This test looks contrived; it's using appending
linkage with a regular variable. The LangRef suggests this is illegal
(and suggests another missing verifier check).




More information about the All-commits mailing list