summaryrefslogtreecommitdiffstats
path: root/mlir/lib/TableGen
diff options
context:
space:
mode:
authorLei Zhang <antiagainst@google.com>2019-10-30 11:12:21 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-10-30 11:12:57 -0700
commitcb40e36d3bb93e876ec6d05f128a23f26b952604 (patch)
tree6ef1bea429b51f28ebd65a5e30c915dd5b68a7c6 /mlir/lib/TableGen
parent05a5a4141648218db2440b4e3a355398ef822111 (diff)
downloadbcm5719-llvm-cb40e36d3bb93e876ec6d05f128a23f26b952604.tar.gz
bcm5719-llvm-cb40e36d3bb93e876ec6d05f128a23f26b952604.zip
Fix segfault when no symbol is given to an constraint operand
This fixed the segfault when we see the following pattern: Pat<(...), (...), [(... 1, 2, 3), ...]> PiperOrigin-RevId: 277544300
Diffstat (limited to 'mlir/lib/TableGen')
-rw-r--r--mlir/lib/TableGen/Pattern.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/mlir/lib/TableGen/Pattern.cpp b/mlir/lib/TableGen/Pattern.cpp
index 2986f30dee6..ddec0bacac4 100644
--- a/mlir/lib/TableGen/Pattern.cpp
+++ b/mlir/lib/TableGen/Pattern.cpp
@@ -480,8 +480,14 @@ std::vector<tblgen::AppliedConstraint> tblgen::Pattern::getConstraints() const {
std::vector<std::string> entities;
entities.reserve(dagInit->arg_size());
- for (auto *argName : dagInit->getArgNames())
+ for (auto *argName : dagInit->getArgNames()) {
+ if (!argName) {
+ PrintFatalError(
+ def.getLoc(),
+ "operands to additional constraints can only be symbol references");
+ }
entities.push_back(argName->getValue());
+ }
ret.emplace_back(cast<llvm::DefInit>(dagInit->getOperator())->getDef(),
dagInit->getNameStr(), std::move(entities));
OpenPOWER on IntegriCloud