[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 08:39:13 PDT 2024


================
@@ -1567,68 +1242,33 @@ void LoadInst::AssertOK() {
          "Ptr must have pointer type.");
 }
 
-static Align computeLoadStoreDefaultAlign(Type *Ty, BasicBlock *BB) {
-  assert(BB && "Insertion BB cannot be null when alignment not provided!");
+static Align computeLoadStoreDefaultAlign(Type *Ty, InsertPosition Pos) {
+  assert(Pos.isValid() &&
+         "Insertion position cannot be null when alignment not provided!");
+  BasicBlock *BB = ((BasicBlock::iterator)Pos).getNodeParent();
----------------
nikic wrote:

```suggestion
  BasicBlock *BB = Pos.getBasicBlock();
```

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


More information about the cfe-commits mailing list