[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 19 06:17:23 PDT 2024


================
@@ -1460,56 +1184,29 @@ static Value *getAISize(LLVMContext &Context, Value *Amt) {
   return Amt;
 }
 
-static Align computeAllocaDefaultAlign(Type *Ty, BasicBlock *BB) {
-  assert(BB && "Insertion BB cannot be null when alignment not provided!");
+static Align computeAllocaDefaultAlign(Type *Ty, InsertPosition Pos) {
+  assert(Pos.IsValid() &&
+         "Insertion position cannot be null when alignment not provided!");
+  BasicBlock *BB = ((BasicBlock::iterator)Pos).getNodeParent();
----------------
nikic wrote:

Maybe add a getParent() method on InsertPosition?

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


More information about the cfe-commits mailing list