[llvm] [SandboxVec][BottomUpVec] Add cost estimation and tr-accept-or-revert pass (PR #124620)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 15:44:58 PST 2025


================
@@ -57,6 +57,24 @@ void Region::add(Instruction *I) {
   Scoreboard.add(I);
 }
 
+void Region::setAux(ArrayRef<Instruction *> Aux) {
+  this->Aux = SmallVector<Instruction *>(Aux);
+  auto &LLVMCtx = Ctx.LLVMCtx;
+  for (auto [Idx, I] : enumerate(Aux)) {
+    llvm::ConstantInt *IdxC =
+        llvm::ConstantInt::get(LLVMCtx, llvm::APInt(32, Idx, false));
+    cast<llvm::Instruction>(I->Val)->setMetadata(
+        AuxMDKind, MDNode::get(LLVMCtx, ConstantAsMetadata::get(IdxC)));
+  }
+}
+
+void Region::setAux(uint32_t Idx, Instruction *I) {
+  uint32_t ExpectedSz = Idx + 1;
+  if (Aux.size() < ExpectedSz)
+    Aux.resize(ExpectedSz);
+  Aux[Idx] = I;
----------------
vporpo wrote:

This version of `setAux()` is only meant to be used internally, after metadata get updated. I changed its visibility to private.

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


More information about the llvm-commits mailing list