Skip to content

Instantly share code, notes, and snippets.

@EgorBo
Last active November 1, 2019 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EgorBo/c9e2b59be61c14de9d1f3a903424e7ea to your computer and use it in GitHub Desktop.
Save EgorBo/c9e2b59be61c14de9d1f3a903424e7ea to your computer and use it in GitHub Desktop.
using System;
using System.Runtime.CompilerServices;
using System.Threading;
public class P
{
static void Main()
{
for (int i = 0; i < 1000; i++)
{
Test(0, 0, 1);
Thread.Yield();
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Test(int x, int y, int z)
{
// first two are always `0` so it makes sense to check `z` first
if (x == 0 && y == 0 && z == 0)
throw new Exception("unreachable");
// so I expect PGO to roll it to
// if (z == 0 && x == 0 && y == 0)
// throw new Exception("unreachable");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment