AOT: fix min()/max() boxed variadic compare (#23779) - #23801
Merged
Conversation
…23779) JitMinMax inverted the max() double/boxed compare select and returned compare scalars instead of the winning __value__ operand, breaking cases like max(g(1), g(3)) and string max() on the AOT path. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
max()compare/select inJitMinMax::reduceNativeDouble(variadic float path).min()/max()lowering to return the winning__value__*operand instead of a compare scalar; add lexicographicstrcmppath when both operands are strings.Root cause:
reduceNumericBoxescompared coerced doubles but kept the smaller compare magnitude and used reversed branch logic formax(), somax(g(1), g(3))returned2andmax('xy','zw')returnedfloat(0).Test plan
php bin/vm.php test/repro/issue_23779_max_nested_call.php— VM:6/zw./phpc build -o /tmp/r test/repro/issue_23779_max_nested_call.php && /tmp/r— AOT:6/zwphp bin/vm.php test/differential/cases/e09_nested_calls.php— VM:6/5./phpc build -o /tmp/e09 test/differential/cases/e09_nested_calls.php && /tmp/e09— AOT:6/5php bin/vm.php test/repro/issue_4347_max_min_numeric_string.php+ AOT build —3.5/2(unchanged)script/differential-sweep.sh --aot— 29/55 match Zend (was 28/54 on master before this branch)ci-fast.shnot run (scoped AOT builtin change only)Closes #23779 (partial — one cluster; remaining AOT sweep failures tracked on the umbrella issue).
Made with Cursor