[Mlir-commits] [mlir] 79f059c - [mlir] NFC - Fix OperationSupport.cpp::findNamedAttr
Nicolas Vasilache
llvmlistbot at llvm.org
Mon May 18 06:39:43 PDT 2020
Author: Nicolas Vasilache
Date: 2020-05-18T09:36:00-04:00
New Revision: 79f059c4ac8cc63c770069557ed9a1f5b921c2c8
URL: https://github.com/llvm/llvm-project/commit/79f059c4ac8cc63c770069557ed9a1f5b921c2c8
DIFF: https://github.com/llvm/llvm-project/commit/79f059c4ac8cc63c770069557ed9a1f5b921c2c8.diff
LOG: [mlir] NFC - Fix OperationSupport.cpp::findNamedAttr
Summary:
When NamedAttrList::get is called against a StringRef and the
entry is not present, the Identifier::operator== crashes.
Interestingly there seems to be no use of the NamedAttrList::get(StringRef) in
the codebase so far. A subsequent commit will introduce such a use.
Differential Revision: https://reviews.llvm.org/D80089
Added:
Modified:
mlir/lib/IR/OperationSupport.cpp
Removed:
################################################################################
diff --git a/mlir/lib/IR/OperationSupport.cpp b/mlir/lib/IR/OperationSupport.cpp
index f326d621ee0c..ef2b377cb1f3 100644
--- a/mlir/lib/IR/OperationSupport.cpp
+++ b/mlir/lib/IR/OperationSupport.cpp
@@ -97,7 +97,7 @@ static auto *findAttr(SmallVectorImpl<NamedAttribute> &attrs, T name,
}
auto *it = llvm::lower_bound(attrs, name);
- if (it->first != name)
+ if (it == attrs.end() || it->first != name)
return attrs.end();
return it;
}
More information about the Mlir-commits
mailing list