[llvm] [CalcSpillWeights] Avoid x87 excess precision influencing weight result (PR #100165)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 10:11:02 PDT 2024


================
@@ -257,7 +257,9 @@ float VirtRegAuxInfo::weightCalcHelper(LiveInterval &LI, SlotIndex *Start,
       return -1.0f;
     }
 
-    float Weight = 1.0f;
+    // Force Weight onto the stack so that x86 doesn't add hidden precision,
+    // similar to HWeight below.
+    volatile float Weight = 1.0f;
----------------
arsenm wrote:

Can we wrap this in a macro in Support somewhere to only do this if using degenerate x87 handling? 

https://github.com/llvm/llvm-project/pull/100165


More information about the llvm-commits mailing list