On 2 May 2011 11:08, Stefan Behnel <stefan...@behnel.de> wrote: > Robert Bradshaw, 30.04.2011 08:16: >> >> On Fri, Apr 29, 2011 at 8:04 AM, mark florisson >>> >>> With the type matching it matches on exactly 'if src_type is >>> dst_type:' so you can't use 'and' and such... perhaps I should turn >>> these expression into a node with the constant value first and then >>> see if the result of the entire expression is known at compile time? >> >> Yes, that's exactly what I was thinking you should do. > > For now, you could simply (try to) re-run the ConstantFolding transform > after the type splitting. It will evaluate constant expressions and also > drop unreachable branches from conditionals.
Right thanks! I actually ran it on the condition only, as I overlooked its branch pruning capability (sometimes I see 'if (1)' generated code, so that's probably because that happens after ConstantFolding). So wouldn't it be a good idea to just insert another ConstantFolding transform at the end of the pipeline also, and have it recalculate constants in case it was previously determined not_a_constant? > Stefan > _______________________________________________ > cython-devel mailing list > cython-devel@python.org > http://mail.python.org/mailman/listinfo/cython-devel > _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel