This is an archive of the discontinued LLVM Phabricator instance.

lit: Remove the binary_feature function and inline it everywhere.
Needs ReviewPublic

Authored by pcc on Mar 8 2019, 2:45 PM.

Details

Summary

This is not only less code but makes the feature names easier to grep for.

Event Timeline

pcc created this revision.Mar 8 2019, 2:45 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: delcypher. · View Herald Transcript
pcc updated this revision to Diff 189944.Mar 8 2019, 2:46 PM
  • Fix typo
Harbormaster completed remote builds in B28951: Diff 189944.
hctim added a comment.Mar 8 2019, 2:57 PM

I see four instances of nozlib. Could we canonicalise the prefix to not_zlib and update the following?

test/MC/ELF/nocompression.s
test/tools/llvm-dwp/X86/nocompress.test
test/tools/llvm-profdata/nocompress.test
tools/clang/test/Driver/nozlibcompress.c

For some context, the reason I added this in the first place is because there used to be a lot of inconsistency in the feature names, so I was trying to give consistency. For example, we would have not-<feature> in some places and <not>_feature in other places. You can even see an example of this here, where it's zlib and nozlib instead of zlib and not_zlib. This inconsistency makes it hard for people to guess the correct negation for the feature they're trying to specify.

Or, someone would define the feature but not the converse of it, so we'd get x but there would be no corresponding feature for not_x.

pcc added a comment.Mar 8 2019, 3:04 PM

Hmm, I remembered that we can just do e.g. REQUIRES: !asan. So maybe we should make that change globally and only define the positive features here.

In D59160#1423435, @pcc wrote:

Hmm, I remembered that we can just do e.g. REQUIRES: !asan. So maybe we should make that change globally and only define the positive features here.

I wasn't aware that was even a thing. If you can confirm that works, then yes defining only the positive featuers would be an improvement. You might want to announce to the list for visibility though.

hctim added a comment.Mar 8 2019, 3:17 PM

I wasn't aware that was even a thing. If you can confirm that works, then yes defining only the positive featuers would be an improvement. You might want to announce to the list for visibility though.

Me neither. By my quick grep, it looks like there are 13 places where we use a negation-based feature in REQUIRES (i.e. the requirement starts with no). I would be happy to do the cleanup next week if this is what we want.