Closed miklos1 closed 4 years ago
I suppose that the code generation pass needs to be type-aware enough to declare variables of the correct type.
That would be the proper solution. A quick fix could be to generate creal(x) OP creal(y)
instead of x OP y
in complex mode, where OP
is a comparison operator. Ideally, C compiler could optimise away the extra rubbish generated this way.
Another possible approach would be to hack around the inlining rules...
For reference: FEniCS/ffcx#127
I think that 6391bbc does (at least in loopy mode) my proposed type propagation fix.
Originally reported in firedrakeproject/firedrake#1255. Minimal failing example:
real(x[0])
will be CSEd, and thus assigned to a temporary variable, however, that variable has typedouble complex
so the subsequent comparison does not compile with the C compiler.