Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Make IsRelocatable use the Clang builtin __is_trivially_relocatable(T) #2159

Closed
wants to merge 1 commit into from

Conversation

Quuxplusone
Copy link
Contributor

Clang 18's __is_trivially_relocatable(T) isn't yet compatible with Folly's use of the term; false negatives are fine, but Clang dangerously gives false positives. However, after llvm/llvm-project#84621, the builtin will no longer give any (known) false positives, which means it will be safe for Folly to start using the builtin as of Clang 19+.

I'm posting this here hoping to kickstart a Folly discussion — "is Folly in favor of the Clang patch? would Folly indeed start using the Clang builtin, if it were long-term supported with the Folly(/Abseil/BSL/Qt/P1144/etc) semantics?"

Please do not merge this patch until llvm/llvm-project#84621 is successfully merged upstream; that patch is a prerequisite for this one.

@Quuxplusone
Copy link
Contributor Author

(attn @ot, @Gownta)

Clang 18's `__is_trivially_relocatable(T)` isn't yet compatible with Folly's
use of the term; false negatives are fine, but Clang dangerously gives
false positives. However, after llvm/llvm-project#84621 ,
the builtin will no longer give any (known) false positives, which means
it will be safe for Folly to start using the builtin as of Clang 19+.
@facebook-github-bot
Copy link
Contributor

@Orvid has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@Quuxplusone
Copy link
Contributor Author

Suggest closing this one in favor of #2216.

@Orvid Orvid closed this Jun 4, 2024
facebook-github-bot pushed a commit that referenced this pull request Jun 17, 2024
)

Summary:
Well, llvm/llvm-project#84621 isn't going anywhere in Clang, therefore #2159 will presumably never be mergeable (in the foreseeable future, anyway).

So here's an alternative approach, for your consideration: If [P1144's feature-test macro](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p1144r10.html#wording) is set, then use `std::is_trivially_relocatable<T>` in place of `std::is_trivially_copyable<T>`.
This will produce improved codegen for e.g. `fbvector<std::vector<int>>::erase`, when compiled on a compiler supporting P1144 semantics. https://godbolt.org/z/s6sa313h3

Compare https://github.com/charles-salvia/std_error/blob/3abc272/all_in_one.hpp#L180-L196

Pull Request resolved: #2216

Reviewed By: Gownta

Differential Revision: D58147899

Pulled By: Orvid

fbshipit-source-id: 671ed21eeb6080f583e6966e776d243c99c9c17f
facebook-github-bot pushed a commit to facebook/hhvm that referenced this pull request Jun 17, 2024
Summary:
Well, llvm/llvm-project#84621 isn't going anywhere in Clang, therefore facebook/folly#2159 will presumably never be mergeable (in the foreseeable future, anyway).

So here's an alternative approach, for your consideration: If [P1144's feature-test macro](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p1144r10.html#wording) is set, then use `std::is_trivially_relocatable<T>` in place of `std::is_trivially_copyable<T>`.
This will produce improved codegen for e.g. `fbvector<std::vector<int>>::erase`, when compiled on a compiler supporting P1144 semantics. https://godbolt.org/z/s6sa313h3

Compare https://github.com/charles-salvia/std_error/blob/3abc272/all_in_one.hpp#L180-L196

X-link: facebook/folly#2216

Reviewed By: Gownta

Differential Revision: D58147899

Pulled By: Orvid

fbshipit-source-id: 671ed21eeb6080f583e6966e776d243c99c9c17f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants