[PATCH] D80497: Make mlir::Value's bool conversion operator explicit
Benjamin Kramer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 24 14:24:07 PDT 2020
bkramer updated this revision to Diff 265944.
bkramer added a comment.
Put back sort
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80497/new/
https://reviews.llvm.org/D80497
Files:
mlir/include/mlir/EDSC/Builders.h
mlir/include/mlir/IR/Value.h
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/lib/Parser/Parser.cpp
Index: mlir/lib/Parser/Parser.cpp
===================================================================
--- mlir/lib/Parser/Parser.cpp
+++ mlir/lib/Parser/Parser.cpp
@@ -3542,14 +3542,14 @@
// Check for any forward references that are left. If we find any, error
// out.
if (!forwardRefPlaceholders.empty()) {
- SmallVector<std::pair<const char *, Value>, 4> errors;
+ SmallVector<const char *, 4> errors;
// Iteration over the map isn't deterministic, so sort by source location.
for (auto entry : forwardRefPlaceholders)
- errors.push_back({entry.second.getPointer(), entry.first});
+ errors.push_back(entry.second.getPointer());
llvm::array_pod_sort(errors.begin(), errors.end());
for (auto entry : errors) {
- auto loc = SMLoc::getFromPointer(entry.first);
+ auto loc = SMLoc::getFromPointer(entry);
emitError(loc, "use of undeclared SSA value name");
}
return failure();
Index: mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
===================================================================
--- mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
+++ mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
@@ -281,7 +281,8 @@
}
});
- assert((!options.unroll ^ result) && "Expected resulting Value iff unroll");
+ assert((!options.unroll ^ (bool)result) &&
+ "Expected resulting Value iff unroll");
if (!result)
result = std_load(vector_type_cast(MemRefType::get({}, vectorType), alloc));
rewriter.replaceOp(op, result);
Index: mlir/include/mlir/IR/Value.h
===================================================================
--- mlir/include/mlir/IR/Value.h
+++ mlir/include/mlir/IR/Value.h
@@ -92,7 +92,7 @@
return U(ownerAndKind);
}
- operator bool() const { return ownerAndKind.getPointer(); }
+ explicit operator bool() const { return ownerAndKind.getPointer(); }
bool operator==(const Value &other) const {
return ownerAndKind == other.ownerAndKind;
}
Index: mlir/include/mlir/EDSC/Builders.h
===================================================================
--- mlir/include/mlir/EDSC/Builders.h
+++ mlir/include/mlir/EDSC/Builders.h
@@ -303,7 +303,7 @@
"MemRef, RankedTensor or Vector expected");
}
- bool hasValue() const { return value; }
+ bool hasValue() const { return (bool)value; }
Value getValue() const {
assert(value && "StructuredIndexed Value not set.");
return value;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80497.265944.patch
Type: text/x-patch
Size: 2445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200524/fa715710/attachment-0001.bin>
More information about the llvm-commits
mailing list