There was a memory corruption issue where the lifespan of the ArrayRef<StringRef> would fail. Directly passing the data will avoid the issue.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/IR/AttributeDetail.h | ||
---|---|---|
614 | I don't understand the fix, can you elaborate? Seems like the ArrayRef is passed by value to the KeyTy so I don't get the lifetime issue? |
mlir/lib/IR/AttributeDetail.h | ||
---|---|---|
614 | We were creating an ArrayRef pointing to the local variable firstElt before, but since it is a reference it should be fine. So there is likely a copy of the StringRef in the implicit conversion to ArrayRef. The change here is making us taking the hash of the entire array instead of the first element, I don't think this is necessary, something like this should work as well: return KeyTy(ty, ArrayRef<StringRef>{&firstElt, 1}, hashVal, /*isSplat=*/true); |
mlir/lib/IR/AttributeDetail.h | ||
---|---|---|
614 | Actually nicer and equivalent I think: return KeyTy(ty, data.take_front(), hashVal, /*isSplat=*/true); |
I don't understand the fix, can you elaborate? Seems like the ArrayRef is passed by value to the KeyTy so I don't get the lifetime issue?