mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 10:55:58 +08:00
[mlir] Cleanup: Fix warnings in MLIR
Tested with gcc-10. Other compilers may generate additional warnings. This does not fix all warnings. There are a few extra ones in LLVMCore and MLIR.
* `OpEmitter::getAttrNameIndex`: -Wunused-function (function is private and not used anywhere)
* `PrintOpPass` copy constructor: -Wextra ("Base class should be explicitly initialized in the copy constructor")
* `LegalizeForLLVMExport.cpp`: -Woverflow (overflow is expected, silence warning by making the cast explicit)
Differential Revision: https://reviews.llvm.org/D107525
This commit is contained in:
@@ -115,7 +115,7 @@ struct DotOpConversion : public ConvertOpToLLVMPattern<DotOp> {
|
||||
auto opType = adaptor.a().getType();
|
||||
Type llvmIntType = IntegerType::get(&getTypeConverter()->getContext(), 8);
|
||||
// Dot product of all elements, broadcasted to all elements.
|
||||
auto attr = rewriter.getI8IntegerAttr(0xff);
|
||||
auto attr = rewriter.getI8IntegerAttr(static_cast<int8_t>(0xff));
|
||||
Value scale =
|
||||
rewriter.create<LLVM::ConstantOp>(op.getLoc(), llvmIntType, attr);
|
||||
rewriter.replaceOpWithNewOp<DotIntrOp>(op, opType, adaptor.a(), adaptor.b(),
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
class PrintOpPass : public ViewOpGraphPassBase<PrintOpPass> {
|
||||
public:
|
||||
PrintOpPass(raw_ostream &os) : os(os) {}
|
||||
PrintOpPass(const PrintOpPass &o) : os(o.os.getOStream()) {}
|
||||
PrintOpPass(const PrintOpPass &o) : PrintOpPass(o.os.getOStream()) {}
|
||||
|
||||
void runOnOperation() override {
|
||||
emitGraph([&]() {
|
||||
|
||||
@@ -341,10 +341,6 @@ private:
|
||||
// Generate methods for accessing the attribute names of this operation.
|
||||
void genAttrNameGetters();
|
||||
|
||||
// Return the index of the given attribute name. This is a relative ordering
|
||||
// for this name, used in attribute getters.
|
||||
unsigned getAttrNameIndex(StringRef attrName) const;
|
||||
|
||||
// Generates the OpAsmOpInterface for this operation if possible.
|
||||
void genOpAsmInterface();
|
||||
|
||||
@@ -750,13 +746,6 @@ void OpEmitter::genAttrNameGetters() {
|
||||
}
|
||||
}
|
||||
|
||||
unsigned OpEmitter::getAttrNameIndex(StringRef attrName) const {
|
||||
auto it = attributeNames.find(attrName);
|
||||
assert(it != attributeNames.end() && "expected attribute name to have been "
|
||||
"registered in genAttrNameGetters");
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void OpEmitter::genAttrGetters() {
|
||||
FmtContext fctx;
|
||||
fctx.withBuilder("::mlir::Builder((*this)->getContext())");
|
||||
|
||||
Reference in New Issue
Block a user