[llvm] [mlir] [Python] Develop python bindings for Presburger library (PR #113233)

Maksim Levental via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 07:58:17 PST 2024


makslevental wrote:

> This will need some top-level documentation about object ownership. Tableaus are rather large

I don't think that's true? They just hold `MlirPresburgerIntegerRelation` which is our standard opaque-ish pointer thing?

> and I see a bunch of `keep_alive` that are difficult to follow without knowing the overall goal.

There are only two and I believe they're to prevent a use-after-free here:

https://github.com/llvm/llvm-project/blob/0744372033893bf33ee3e8ae71241a2d8239a421/mlir/lib/Bindings/Python/Presburger.cpp#L48-L52

I made a comment above that it would be simpler to just promote `at64` to `PyPresburgerRelation` itself, which would resolve your qualm as well.

https://github.com/llvm/llvm-project/pull/113233


More information about the llvm-commits mailing list