This makes ignoring a result explicit by the user, and helps to prevent accidental errors with dropped results. Marking LogicalResult as no discard was always the intention from the beginning, but got lost along the way.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Perhaps a high level question: is the intention to just retain the current behavior or to check up on cases where currently not checked?
mlir/lib/Dialect/Affine/Utils/Utils.cpp | ||
---|---|---|
223 | Why doesnt this return failure if this fails? |
mlir/include/mlir/Support/LogicalResult.h | ||
---|---|---|
16–17 | Maybe add a blurb here about the fact that it is nodiscard, and how to explicitly discard it if needed (the (void) trick -- not obvious to most folks). Also maybe document a best practice about only using it in contexts where it makes sense to always check the result? |
The intention for this revision is to be mostly NFC. I'll look at a few obvious fixes, but a lot of these seem to indicate a general lack of testing which would be better served by proper followups by the owners of the affected components. I plan to file bugs against these owners to look into/resolve the (void)s added for their components in this revision.
mlir/lib/Dialect/Affine/Utils/Utils.cpp | ||
---|---|---|
223 | An applyPatternsAndFoldGreedily failure just means that it failed to converge when applying patterns. Returning failure in this case (and in most TBH) wouldn't make sense here given that failing to converge on the cleanup doesn't mean that the hoisting failed. I'm honestly considering moving the indication of non-convergence to an optional parameter or something, given the above. |
Maybe add a blurb here about the fact that it is nodiscard, and how to explicitly discard it if needed (the (void) trick -- not obvious to most folks).
Also maybe document a best practice about only using it in contexts where it makes sense to always check the result?