diff options
| author | Nicolas Vasilache <ntv@google.com> | 2019-01-31 08:05:11 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 16:04:23 -0700 |
| commit | ea963d7e288133ae307e82f401c9f3eb957f13e7 (patch) | |
| tree | ff2be507b89456481d2b040f78427912b24d2f9d /mlir/lib/Analysis/NestedMatcher.cpp | |
| parent | d4921f4a96a46e24c2fb76ca7feb66e6894395d2 (diff) | |
| download | bcm5719-llvm-ea963d7e288133ae307e82f401c9f3eb957f13e7.tar.gz bcm5719-llvm-ea963d7e288133ae307e82f401c9f3eb957f13e7.zip | |
Post commit fixes
This CL introduces a hotfix post refactoring of NestedMatchers:
- fix uninitialized read to skip
- avoid bumpptr allocating with 0 elements
Interestingly the latter issue only surfaced in fastbuild mode with no-san and
manifested itself by a SIGILL. All other combinations that were tried failed to
reproduce the issue (dbg, opt, fastbuild with asan)
PiperOrigin-RevId: 231787642
Diffstat (limited to 'mlir/lib/Analysis/NestedMatcher.cpp')
| -rw-r--r-- | mlir/lib/Analysis/NestedMatcher.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mlir/lib/Analysis/NestedMatcher.cpp b/mlir/lib/Analysis/NestedMatcher.cpp index 43e3b332a58..46bf5ad0b97 100644 --- a/mlir/lib/Analysis/NestedMatcher.cpp +++ b/mlir/lib/Analysis/NestedMatcher.cpp @@ -51,10 +51,12 @@ llvm::BumpPtrAllocator *&NestedPattern::allocator() { NestedPattern::NestedPattern(Instruction::Kind k, ArrayRef<NestedPattern> nested, FilterFunctionType filter) - : kind(k), nestedPatterns(ArrayRef<NestedPattern>(nested)), filter(filter) { - auto *newNested = allocator()->Allocate<NestedPattern>(nested.size()); - std::uninitialized_copy(nested.begin(), nested.end(), newNested); - nestedPatterns = ArrayRef<NestedPattern>(newNested, nested.size()); + : kind(k), nestedPatterns(), filter(filter), skip(nullptr) { + if (!nested.empty()) { + auto *newNested = allocator()->Allocate<NestedPattern>(nested.size()); + std::uninitialized_copy(nested.begin(), nested.end(), newNested); + nestedPatterns = ArrayRef<NestedPattern>(newNested, nested.size()); + } } unsigned NestedPattern::getDepth() const { |

