From 79f059c4ac8cc63c770069557ed9a1f5b921c2c8 Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Mon, 18 May 2020 09:33:35 -0400 Subject: [PATCH] [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 --- mlir/lib/IR/OperationSupport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/lib/IR/OperationSupport.cpp b/mlir/lib/IR/OperationSupport.cpp index f326d62..ef2b377 100644 --- a/mlir/lib/IR/OperationSupport.cpp +++ b/mlir/lib/IR/OperationSupport.cpp @@ -97,7 +97,7 @@ static auto *findAttr(SmallVectorImpl &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; } -- 2.7.4