-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Track local var ranges for "interfering writes" LIR check #64804
Track local var ranges for "interfering writes" LIR check #64804
Conversation
For LIR we verify that we can really consider locals to be used at their user by having a checker that looks for interfering stores to the same locals. However, in some cases we may have "interfering" GT_LCL_FLD/GT_STORE_LCL_FLD, in the sense that they work on the same local but on a disjoint range of bytes. Add support to validate this. This fixes dotnet#57919 which made the fuzzer jobs very noisy and made it easy to miss actual new examples (e.g. dotnet#63720 was just merged even though there were real examples found there). Fix dotnet#57919
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsFor LIR we verify that we can really consider locals to be used at their This fixes #57919 which made the fuzzer jobs very noisy and made it easy Fix #57919
|
/azp run Fuzzlyn |
Azure Pipelines successfully started running 1 pipeline(s). |
cc @dotnet/jit-contrib Also @AndyAyersMS there are some presumably forward-sub related failures in the Fuzzlyn run from this PR: https://dev.azure.com/dnceng/public/_build/results?buildId=1591834&view=ms.vss-build-web.run-extensions-tab |
Thanks, will take a look. |
The x64 windows Forward sub creates
Eventually this gets optimized to
with the expectation that the FIELD/IND will evaluate before the call, but they get reordered.
|
It seems like something that |
Yeah, xarch's Lowering::ContainCheckCompare is missing a safety check: @@ -4949,7 +4949,7 @@ void Lowering::ContainCheckCompare(GenTreeOp* cmp)
// we can treat the MemoryOp as contained.
if (op1Type == op2Type)
{
- if (IsContainableMemoryOp(op1))
+ if (IsContainableMemoryOp(op1) && IsSafeToContainMem(cmp, op1))
{
MakeSrcContained(cmp, op1);
} |
Let me see if this fixes those other cases too. |
I can't repro the first x86 issue (seed 5821979800164656837). |
This repros (in both x64 and x86): // Generated by Fuzzlyn v1.5 on 2022-02-04 12:51:20
// Run on X86 Windows
// Seed: 5821979800164656837
// Reduced from 60.0 KiB to 0.3 KiB in 00:01:44
// Debug: Outputs 0
// Release: Outputs -1
public class Program
{
public static IRT s_rt;
public static long s_4;
public static void Main()
{
s_rt = new C();
int vr3 = (int)(s_4 & ~M7());
s_rt.WriteLine(vr3);
}
public static short M7()
{
ref long var1 = ref s_4;
var1 = 9223372036854775807L;
return 0;
}
}
public interface IRT
{
void WriteLine<T>(T value);
}
public class C : IRT
{
public void WriteLine<T>(T value)
{
System.Console.WriteLine(value);
}
} |
Second x86 issue (9341650659269168733) is fixed by the change to Lowering::ContainCheckCompare. |
Thanks. This isn't fixed by the change to Lowering::ContainCheckCompare. |
Think the third x86 issue is also fixed, but still need to verify that it will fail w/o the fix. |
I can't get 17864721711828342668 to fail with main, at least on x86. |
Looks like a similar sort of bug, trying to pin down exactly where we are missing a check. Here the parent is Just skimming though lowerxarch, the pattern of first calling |
I suppose luckily these cases are (were) somewhat rare? No diffs in SPMI from my first bit of fix above. |
For LIR we verify that we can really consider locals to be used at their
user by having a checker that looks for interfering stores to the same
locals. However, in some cases we may have "interfering"
GT_LCL_FLD/GT_STORE_LCL_FLD, in the sense that they work on the same
local but on a disjoint range of bytes. Add support to validate this.
This fixes #57919 which made the fuzzer jobs very noisy and made it easy
to miss actual new examples (e.g. #63720 was just merged even though
there were real examples found there).
Fix #57919