[llvm] [SandboxIR] Add InsertValueInst (PR #106273)

Jorge Gorbe Moya via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 15:40:09 PDT 2024


================
@@ -1451,6 +1456,63 @@ class ShuffleVectorInst final
   }
 };
 
+class InsertValueInst
+    : public SingleLLVMInstructionImpl<llvm::InsertValueInst> {
+  /// Use Context::createInsertValueInst(). Don't call the constructor directly.
+  InsertValueInst(llvm::InsertValueInst *IVI, Context &Ctx)
+      : SingleLLVMInstructionImpl(ClassID::InsertValue, Opcode::InsertValue,
+                                  IVI, Ctx) {}
+  friend Context; // for InsertValueInst()
+
+public:
+  static Value *create(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
+                       BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx,
+                       const Twine &Name = "");
+
+  using idx_iterator = llvm::InsertValueInst::idx_iterator;
----------------
slackito wrote:

@tschuett good catch, thanks!

@vporpo It does pass, and I just double-checked I'm running them with asserts enabled (debug build).

I think it's falling back to `Instruction::classof` and accidentally passing.

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


More information about the llvm-commits mailing list