First patch of patch series that improves MergeFunctions performance time from O(N*N) to
O(N*log(N)). The idea is to introduce total ordering among functions set.
That allows to build binary tree and perform function look-up procedure in O(log(N)) time.
This patch description:
Introduced total ordering among Type instances. Actually it is improvement for existing
0. Coerce pointer of 0 address space to integer.
- If left and right types are equal (the same Type* value), return 0 (means equal).
- If types are of different kind (different type IDs). Return result of type IDs
comparison, treating them as numbers.
- If types are vectors or integers, return result of its
pointers comparison (casted to numbers).
- Check whether type ID belongs to the next group:
If so, return 0.
- If left and right are pointers, return result of address space
comparison (numbers comparison).
- If types are complex.
Then both LEFT and RIGHT will be expanded and their element types will be checked with
the same way. If we get Res != 0 on some stage, return it. Otherwise return 0.
- For all other cases put llvm_unreachable.