[clang] [llvm] [IR] Do not store Function inside BlockAddress (PR #137958)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 30 06:30:00 PDT 2025


================
@@ -912,6 +912,11 @@ class BlockAddress final : public Constant {
   /// block must be embedded into a function.
   static BlockAddress *get(BasicBlock *BB);
 
+  /// Return a BlockAddress for the specified basic block, which may not be
+  /// part of a function. The specified type must match the type of the function
+  /// the block will be inserted into.
+  static BlockAddress *get(Type *Ty, BasicBlock *BB);
----------------
nikic wrote:

I'd say "no unless it's actually needed". We should avoid creating blockaddresses for non-inserted blocks if possible.

https://github.com/llvm/llvm-project/pull/137958


More information about the cfe-commits mailing list