Page MenuHomePhabricator

[IR] Short-circuit comparison with itself for Attributes
ClosedPublic

Authored by danilaml on Mon, Jun 22, 6:26 AM.

Diff Detail

Event Timeline

danilaml created this revision.Mon, Jun 22, 6:26 AM
Herald added a project: Restricted Project. · View Herald Transcript
danilaml marked an inline comment as done.Mon, Jun 22, 6:31 AM
danilaml added inline comments.
llvm/lib/IR/Attributes.cpp
614

This avoids potential assert here (which can be triggered when glibc tests irreflexivity with expensive checks enabled).

danilaml updated this revision to Diff 272428.Mon, Jun 22, 7:32 AM

Can this be covered in LLVM's regression tests?

danilaml updated this revision to Diff 272677.Tue, Jun 23, 4:43 AM

@dblaikie It was actually failing on some of the lit tests when compiler was compiled with EXPENSIVE_CHECKS enabled (kind of how I discovered it), but after this recent refactor which removed a sort step: https://github.com/llvm/llvm-project/commit/ed766f1bb1040a520fb5646ab75851e2b0fd66df#diff-7b43e801c5abbb03d571f9aad6af63a5L792
I don't know if the codepath with ::sort (which has those checks) can be hit from llvm IR. Instead, I've added an explicit check to AttributesTest.cpp that currently asserts.

This revision is now accepted and ready to land.Thu, Jul 2, 1:15 PM
This revision was automatically updated to reflect the committed changes.