[llvm-dev] RFC: Complex in LLVM

David Greene via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 5 09:16:37 PDT 2019


Bevin Hansson via llvm-dev <llvm-dev at lists.llvm.org> writes:

> On 2019-07-04 03:06, Chris Lattner via llvm-dev wrote:
>>
>> How difficult are these to pattern match on scalar code?
>
> Typically matching patterns like complex multiplication are very 
> sensitive to noise introduced by other optimizations. Having the scalar 
> patterns change even slightly from what the frontend emits makes 
> selecting the operations much harder. They usually involve complex 
> diamonds and multi-result patterns that ISelDAG has trouble with even today.
>
> Having an explicit type representation would also make it easier to keep 
> the complex values together as one. Clang's struct-pair representation 
> today is often broken up by SROA even though it might have been more 
> desirable to keep the real and imaginary parts together in the same 
> register. That's harder to accomplish when all LLVM knows is that it's a 
> struct.

That matches my experience as well.  A higher-level representation is
useful even for scalar.

                       -David


More information about the llvm-dev mailing list