JIT: don't compute edge weights if not optimizing (dotnet/coreclr#19736)
We were spending a bit less than 1% of jit time computing edge weights
for minopts an debug codegen, but then never using them.
Also when optimizing we wanted to just compute edge weights but ran
through a bit more code than that.
Restructure the code so it's clearer what runs when, and bypass the
edge weight computations for minopts and debug codegen.
Commit migrated from https://github.com/dotnet/coreclr/commit/
d43347e043beb3ae64c8db55f72708c1ce60511e