[LoongArch64] Fix the risk of sign-extension in CodeGen::genIntCastOverflowCheck() with CHECK_SMALL_INT_RANGE signed to signed cast case. - #130546
Merged
Conversation
LuckyXu-HF
commented
Jul 11, 2026
Contributor
- Fix the random failed in Release libs.tests: System.Runtime.Numerics.Tests.
- Optimize instructions in CodeGen::genCodeForCompare() with some sub-divide case.
…erflowCheck() with `CHECK_SMALL_INT_RANGE signed to signed cast` case. * Fix the random failed in Release libs.tests: System.Runtime.Numerics.Tests. * Optimize CodeGen::genCodeForCompare() with some sub-divide case.
Contributor
Author
|
The release libs.tests random failed of System.Numerics.Tests.op_rightshiftTest.RunSmallTests Discovering: System.Runtime.Numerics.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Runtime.Numerics.Tests (found 641 of 654 test cases)
Starting: System.Runtime.Numerics.Tests (parallel test collections = on [8 threads], stop on fail = off)
Failed to parse string
System.Numerics.Tests.op_rightshiftTest.RunSmallTests [FAIL]
System.OverflowException : Arithmetic operation resulted in an overflow.
Stack Trace:
/data/xuliangyu/main/runtime/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs(2196,0): at System.Numerics.BigInteger.op_Explicit(BigInteger value)
/data/xuliangyu/main/runtime/src/libraries/System.Runtime.Numerics/tests/BigInteger/MyBigInt.cs(704,0): at System.Numerics.Tests.MyBigIntImp.ShiftLeft(List`1 bytes1, List`1 bytes2)
/data/xuliangyu/main/runtime/src/libraries/System.Runtime.Numerics/tests/BigInteger/MyBigInt.cs(110,0): at System.Numerics.Tests.MyBigIntImp.DoBinaryOperatorMine(BigInteger num1, BigInteger num2, String op, BigInteger& num3)
/data/xuliangyu/main/runtime/src/libraries/System.Runtime.Numerics/tests/BigInteger/stackcalculator.cs(71,0): at System.Numerics.Tests.StackCalc.DoNextOperation()
/data/xuliangyu/main/runtime/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_rightshift.cs(226,0): at System.Numerics.Tests.op_rightshiftTestBase.VerifyRightShiftString(String opstring)
/data/xuliangyu/main/runtime/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_rightshift.cs(214,0): at System.Numerics.Tests.op_rightshiftTestBase.RunSmallTests()
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
/data/xuliangyu/main/runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs(37,0): at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
/data/xuliangyu/main/runtime/src/libraries/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs(134,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
Finished: System.Runtime.Numerics.Tests
=== TEST EXECUTION SUMMARY ===
System.Runtime.Numerics.Tests Total: 3033, Errors: 0, Failed: 1, Skipped: 0, Time: 32.050sThis commit is mainly to fix the above issue, based on this fix the test passed 100 times with 0 failed. |
LuckyXu-HF
commented
Jul 11, 2026
Contributor
Author
|
@shushanhf @jakobbotsch Could you please review this PR? Thanks. |
shushanhf
approved these changes
Jul 13, 2026
shushanhf
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks!
We tested it OK on our local LA64-machine.
@jakobbotsch Could you give some advices ? thanks
jakobbotsch
approved these changes
Jul 13, 2026
eiriktsarpalis
pushed a commit
that referenced
this pull request
Jul 15, 2026
…erflowCheck() with `CHECK_SMALL_INT_RANGE signed to signed cast` case. (#130546) * Fix the random failed in Release libs.tests: System.Runtime.Numerics.Tests. * Optimize instructions in CodeGen::genCodeForCompare() with some sub-divide case.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.