[all-commits] [llvm/llvm-project] 4831e0: [IR] Disallow recursive types (#114799)

Jay Foad via All-commits all-commits at lists.llvm.org
Tue Nov 5 01:41:33 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4831e0aa88debb3b7d0528bfd85db73a6a03aeff
      https://github.com/llvm/llvm-project/commit/4831e0aa88debb3b7d0528bfd85db73a6a03aeff
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2024-11-05 (Tue, 05 Nov 2024)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/docs/ReleaseNotes.md
    M llvm/include/llvm/IR/DerivedTypes.h
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    M llvm/lib/IR/Type.cpp
    M llvm/lib/Linker/IRMover.cpp
    A llvm/test/Assembler/mutually-recursive-types.ll
    M llvm/test/Assembler/unsized-recursive-type.ll
    M llvm/test/Linker/pr22807.ll
    R llvm/test/Verifier/recursive-struct-param.ll
    R llvm/test/Verifier/recursive-type-1.ll
    R llvm/test/Verifier/recursive-type-2.ll
    R llvm/test/Verifier/recursive-type-load.ll
    R llvm/test/Verifier/recursive-type-store.ll
    M llvm/unittests/Analysis/TargetLibraryInfoTest.cpp

  Log Message:
  -----------
  [IR] Disallow recursive types (#114799)

StructType::setBody is the only mechanism that can potentially create
recursion in the type system. Add a runtime check that it is not
actually used to create recursion.

If the check fails, report an error from LLParser, BitcodeReader and
IRLinker. In all other cases assert that the check succeeds.

In future StructType::setBody will be removed in favor of specifying the
body when the type is created, so any performance hit from this runtime
check will be temporary.



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