@@ -554,6 +554,8 @@ static Attribute convertCGProfileModuleFlagValue(ModuleOp mlirModule,
554554 return ArrayAttr::get (mlirModule->getContext (), cgProfile);
555555}
556556
557+ // / Extract a two element `MDTuple` from a `MDOperand`. Emit a warning in case
558+ // / something else is found.
557559static llvm::MDTuple *getTwoElementMDTuple (ModuleOp mlirModule,
558560 const llvm::Module *llvmModule,
559561 const llvm::MDOperand &md) {
@@ -564,6 +566,9 @@ static llvm::MDTuple *getTwoElementMDTuple(ModuleOp mlirModule,
564566 return tupleEntry;
565567}
566568
569+ // / Extract a constant metadata value from a two element tuple (<key, value>).
570+ // / Return nullptr if requirements are not met. A warning is emitted if the
571+ // / `matchKey` is different from the tuple's key.
567572static llvm::ConstantAsMetadata *getConstantMDFromKeyValueTuple (
568573 ModuleOp mlirModule, const llvm::Module *llvmModule,
569574 const llvm::MDOperand &md, StringRef matchKey, bool optional = false ) {
@@ -582,6 +587,9 @@ static llvm::ConstantAsMetadata *getConstantMDFromKeyValueTuple(
582587 return dyn_cast<llvm::ConstantAsMetadata>(tupleEntry->getOperand (1 ));
583588}
584589
590+ // / Extract an integer value from a two element tuple (<key, value>).
591+ // / Fail if requirements are not met. A warning is emitted if the
592+ // / found value isn't a LLVM constant integer.
585593static FailureOr<uint64_t >
586594convertInt64FromKeyValueTuple (ModuleOp mlirModule,
587595 const llvm::Module *llvmModule,
0 commit comments