[PATCH] D100380: [Polly] In getBuild() use isl::noexception bindings

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 15 12:14:51 PDT 2021


Meinersbur added a comment.

In D100380#2691641 <https://reviews.llvm.org/D100380#2691641>, @refactormyself wrote:

> I am trying to understand what is meant by "The `__isl_give` might not actually be correct ...". 
> Here is the line of I think is being referred to:
>
> `isl::ast_build Build = IslAstInfo::getBuild(isl::manage_copy(Node));`

The `__isl_give` annotation means that `getBuild` returns an abject for which the caller must assume the ownership of (ie. has the responsibility to eventually free it). `isl::manage_copy(IslAstInfo::getBuild(Node))` Makes a copy of the object returned, so that there are 2 objects. The copied object will eventually be freed by the dtor, but the object returned itself is not.

`isl::manage_copy(Node)` does NOT make a copy of the payload that is returned by `getBuild`.

> If I understand the code, `isl::manage_copy` should raise an exception if Node is not "correct"

Exceptions are disabled in LLVM. There are some assertions in debug builds, but they don't catch everything.

> Do you mean calling `isl::manage_copy` and not `isl::manage` on `Payload->Build` , so it checks and raises an exception?

Moving the `isl::manage_copy` from the caller of `getBuild` into the method itself.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100380/new/

https://reviews.llvm.org/D100380



More information about the llvm-commits mailing list