diff options
author | Nikita Popov <npopov@redhat.com> | 2025-05-02 09:40:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-02 09:40:50 +0200 |
commit | 4109bac3301eb7b7033eec3c8e8107be8cad9bc9 (patch) | |
tree | e2f28b7cca07f00337268f6a717d461bb2e15591 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | ff28e1a5a92da380c2869aba09971687c26d2f0f (diff) | |
download | llvm-4109bac3301eb7b7033eec3c8e8107be8cad9bc9.zip llvm-4109bac3301eb7b7033eec3c8e8107be8cad9bc9.tar.gz llvm-4109bac3301eb7b7033eec3c8e8107be8cad9bc9.tar.bz2 |
[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.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 4d29cea..d773cdd 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -2286,7 +2286,7 @@ llvm::BlockAddress *CodeGenFunction::GetAddrOfLabel(const LabelDecl *L) { // Make sure the indirect branch includes all of the address-taken blocks. IndirectBranch->addDestination(BB); - return llvm::BlockAddress::get(CurFn, BB); + return llvm::BlockAddress::get(CurFn->getType(), BB); } llvm::BasicBlock *CodeGenFunction::GetIndirectGotoBlock() { |