[PATCH] D125212: [GlobalISel] Allow destination patterns having empty outs
Abinav Puthan Purayil via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 17 04:14:08 PDT 2022
abinavpp added a comment.
In D125212#3517386 <https://reviews.llvm.org/D125212#3517386>, @arsenm wrote:
> In D125212#3510705 <https://reviews.llvm.org/D125212#3510705>, @abinavpp wrote:
>
>> In D125212#3500234 <https://reviews.llvm.org/D125212#3500234>, @arsenm wrote:
>>
>>> I do think there should be a builtin hasOneUse pattern predicate the emitter could use to verify
>>
>> If we have a `bit HasNoUse` builtin predicate in PatFrags we can get the matcher
>> table to check the empty usage of the result without the generic C++ predicates.
>> The problem I'm seeing here is that the default behaviour should be to not check
>> for the use count since most of the selection doesn't care about it. Having a
>> ternary HasNoUse builtin is fine since we could set it to false for selection
>> that needs at least 1 use (e.g.: AMDGPU's return atomic ops), true for selection
>> that needs no use (e.g.: AMDGPU's no return atomic ops), "don't care" for the
>> majority of the other selections. I don't think we can rely on the '?'
>> (uninitialized) value since TreePredicateFn::isPredefinedPredicateEqualTo()
>> return false for uninitialized fields.
>>
>> How should we do this?
>
> Having a false/unset builtin HasOneUse predicate doesn't imply applying the negated predicate. It would just be nothing. If we wanted a hasOneOrMultiple predicate, it would be a separate PatFrag bit
I'm assuming you mean has(No)Use, I don't see the relevance of checking for one
use here.
I agree with you on omitting the predicates if the field is set to
false/uninitialized. In that case, how about we add the following to
PatFrags:
// If set to true, a predicate is added that checks for at least one use of
// the return value; Otherwise no predicate is added.
bit HasUse = ?;
// If set to true, a predicate is added that checks for no use of the return
// value; Otherwise no predicate is added.
//
// The TableGen backend asserts that both HasUse and HasNoUse is not set to
// true.
bit HasNoUse = ?;
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125212/new/
https://reviews.llvm.org/D125212
More information about the llvm-commits
mailing list