[llvm-dev] [RFC] Vector Predication

David Greene via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 7 09:28:20 PST 2019


Philip Reames <listmail at philipreames.com> writes:

>> Masking has advantages even in the default non-trapping fp
>> environment: It is not uncommon for fp hardware to be slow on
>> denormal values. If you take the operation + select approach,
>> spurious computation on denomals could occur, slowing down the
>> program.
> Why?  If you're backend has support for predicate fsub, you'd just
> pattern match for that.

It's not that simple.  Often the IR gets mangled so badly during
optimization that the pattern is no longer recognizable.  I've fixed
bugs in LLVM where use of select to implement predication was causing
traps because instcombine or something else lifted one of the operands
of the select beyond a point where isel could match it.

select is not semantically equivalent to predication and there is no way
to force it to be without drastically changing the IR specification.

                            -David


More information about the llvm-dev mailing list