[all-commits] [llvm/llvm-project] f8aaec: [OpaquePtr] Support forward references in textual IR

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jun 29 11:10:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f8aaec19e674c44bfffd2b31611ad1eecc4698bd
      https://github.com/llvm/llvm-project/commit/f8aaec19e674c44bfffd2b31611ad1eecc4698bd
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-06-29 (Tue, 29 Jun 2021)

  Changed paths:
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/IR/AsmWriter.cpp
    M llvm/test/CodeGen/WebAssembly/add-prototypes-conflict.ll
    M llvm/test/Other/force-opaque-ptrs.ll
    M llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll
    M llvm/test/Transforms/Attributor/misc.ll
    M llvm/test/Transforms/FunctionSpecialization/function-specialization3.ll
    M llvm/test/Transforms/FunctionSpecialization/function-specialization4.ll
    M llvm/test/Transforms/LowerTypeTests/function-weak.ll
    M llvm/test/Transforms/LowerTypeTests/icall-branch-funnel.ll
    M llvm/test/Transforms/OpenMP/parallel_deletion_remarks.ll
    M llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
    M llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
    M llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-check.ll
    M llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll

  Log Message:
  -----------
  [OpaquePtr] Support forward references in textual IR

Currently, LLParser will create a Function/GlobalVariable forward
reference based on the desired pointer type and then modify it when
it is declared. With opaque pointers, we generally do not know the
correct type to use until we see the declaration.

Solve this by creating the forward reference with a dummy type, and
then performing a RAUW with the correct Function/GlobalVariable when
it is declared. The approach is adopted from
https://github.com/TNorthover/llvm-project/commit/b5b55963f62038319fa7a8b1b232226ba1d8ef3c.

This results in a change to the use list order, which is why we see
test changes on some module passes that are not stable under use list
reordering.

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




More information about the All-commits mailing list