This is an archive of the discontinued LLVM Phabricator instance.

[X86] Mark all x86 specific builtins as nothrow.
ClosedPublic

Authored by craig.topper on May 1 2018, 11:53 AM.

Details

Summary

I believe all of the x86 builtins should be considered nothrow.

I've left the incssp builtins alone because I think its current attributes are wrong and I'm following up with the contributor for that.

I plan to start adding const as well, but that requires more careful auditing.

Diff Detail

Repository
rC Clang

Event Timeline

craig.topper created this revision.May 1 2018, 11:53 AM
spatel added a comment.May 1 2018, 4:28 PM

Seems right, but I don't know much about nothrow. Does some other attribute on these intrinsics suppress the possibility of throwing an exception? Ie, is there some way to test this?

I can't seem to produce catch/landingpad IR even after putting an intrinsic in a 'try' with 'catch'.

You could write a test like static_assert(noexcept(__builtin_ia32_bzhi_di(0,0)), "");. I don't think it has any other effect.

@eli.friedman is that test worth doing? Would we do it for every builtin?

We don't expect user code to call these builtins directly anyway, so probably not useful to test.

This revision is now accepted and ready to land.May 2 2018, 11:43 AM
This revision was automatically updated to reflect the committed changes.