How to parse llvm.assume intrinsic?

Hi,
According to the manual, llvm.assume intrinsic is quite flexible and can hold various content.
e.x. Both intrinsics are valid intrinsic

call void @llvm.assume(i1 true) [“align”(ptr %val, i32 8)]
call void @llvm.assume(i1 %cond) [“cold”(), “nonnull”(ptr %val)]

However, I did not figure out how to parse it.
If I parse it as a call instruction, (CallInst->getOperand(i)), I did not find a Value which refers to keyword align or cold.

My question is how to correctly parse the llvm.assume intrinsic and retrieve all information?

Thanks in advance.

Take a look at the Verifier.cpp file. It actually contains everything that is needed for parsing.
An example as below:

  for (Use &U : V->uses()) {
    if (CallInst *I = dyn_cast<CallInst>(U.getUser())) {
      Function *Callee = I->getCalledFunction();
      if (Callee && Callee->isIntrinsic() &&
          (Callee->getIntrinsicID() == Intrinsic::assume)) {
        for (auto &Elem : I->bundle_op_infos()) {
          unsigned ArgCount = Elem.End - Elem.Begin;
          Attribute::AttrKind Kind =
              Attribute::getAttrKindFromName(Elem.Tag->getKey());
          if (Kind == Attribute::Alignment) {
           // do something.
          }
        }
      }
    }
  }

The operands in [] are called operand bundles (see LLVM Language Reference Manual — LLVM 18.0.0git documentation)

Look for Operand Bundle API here for more details on how to access and them: LLVM: llvm::CallBase Class Reference