[all-commits] [llvm/llvm-project] 4109ba: [IR] Do not store Function inside BlockAddress (#1...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri May 2 00:41:12 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4109bac3301eb7b7033eec3c8e8107be8cad9bc9
      https://github.com/llvm/llvm-project/commit/4109bac3301eb7b7033eec3c8e8107be8cad9bc9
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-05-02 (Fri, 02 May 2025)

  Changed paths:
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M llvm/include/llvm/IR/Constants.h
    M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    M llvm/lib/CodeGen/AsmPrinter/WinCFGuard.cpp
    M llvm/lib/IR/Constants.cpp
    M llvm/lib/IR/Function.cpp
    M llvm/lib/IR/LLVMContextImpl.h
    M llvm/lib/Transforms/IPO/Attributor.cpp
    M llvm/lib/Transforms/IPO/GlobalOpt.cpp
    M llvm/lib/Transforms/IPO/LowerTypeTests.cpp
    M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
    M llvm/lib/Transforms/IPO/PartialInlining.cpp
    M llvm/lib/Transforms/IPO/SCCP.cpp
    M llvm/test/tools/llvm-reduce/reduce-functions-blockaddress-wrong-function.ll
    M llvm/test/tools/llvm-reduce/reduce-functions-blockaddress.ll
    M llvm/tools/llvm-reduce/deltas/ReduceFunctions.cpp
    M llvm/tools/llvm-reduce/deltas/Utils.cpp
    M llvm/tools/llvm-reduce/deltas/Utils.h
    M mlir/test/Target/LLVMIR/Import/blockaddress.ll

  Log Message:
  -----------
  [IR] Do not store Function inside BlockAddress (#137958)

Currently BlockAddresses store both the Function and the BasicBlock they
reference, and the BlockAddress is part of the use list of both the
Function and BasicBlock.

This is quite awkward, because this is not really a use of the function
itself (and walks of function uses generally skip block addresses for
that reason). This also has weird implications on function RAUW (as that
will replace the function in block addresses in a way that generally
doesn't make sense), and causes other peculiar issues, like the ability
to have multiple block addresses for one block (with different
functions).

Instead, I believe it makes more sense to specify only the basic block
and let the function be implied by the BB parent. This does mean that we
may have block addresses without a function (if the BB is not inserted),
but this should only happen during IR construction.



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