-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert Olden/voronoi benchmark #51
base: master
Are you sure you want to change the base?
Conversation
In particular, the |
In the case of operations involving integers, the current spec says only one of the arguments can have bounds. I didn't know to choose which "bounds" wins when both of the arguments have bounds. However, we could require that if both arguments have bounds, they must be identical. This would handle the special case where the bounds for both arguments are derived from the same variable. I had expected that a programmer would in general be able to resolve the situation of ambiguous bounds inference by assigning the argument that should have bounds to a variable with no bounds declared. However, that isn't possible to do in a macro the produces an expression. There's no way to introduce temporary variables and we'd have to worry about variable capture. |
So right now the two options if there are bounds on both sides are:
I propose a third option:
This should cover the above case, without accepting too much. Also means we don't have to inspect the bounds deeply for equality with respect to commutative/associative operators. |
So, I hacked a little on clang and the answer is that comparing for equality is going to be harder than I thought, especially as the bounds in this example aren't the same object, but do have equivalent expressions for upper and lower. I hacked up a solution where I just chose the LHS if both are present (to see what would happen), and with a few changes this does build, but there's a runtime failure i have to investigate. Incoming commit with the changes to the benchmark, won't commit my change to clang, as it's not a good solution. |
I don't think we need the third option. The point is to avoid ambiguity, and if the bounds expressions are equal, there is no ambiguity. Also, it would be hard to determine if the lvalue expression is the same. We could do it, but it requires a new analysis. We will already have to deal with normalizing bounds expressions for redeclarations. We should use the same approach everywhere for checking equivalency of bounds expressions. |
It is now compiling if I change the compiler to always take the RHS (or the LHS) if both sides have bounds. I don't have a comparison for equality. However, the output it gives is different to the reference output, which I need to investigate, which I'll do now. |
So of course the bounds were actually wrong, and have to also be expressed in terms of the bit-twiddling macros that give us so many issues. I introduced a macro,
This means I'm going to shelve this conversion for the moment. |
This is not yet complete, but I thought I'd push the branch anyway.
In particular, the bounds inference code can't cope with these macros. I'm not entirely sure why.