[llvm] r206765 - CalcSpillWeights: Hack to prevent x87 nonsense
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Apr 21 10:57:01 PDT 2014
Author: dexonsmith
Date: Mon Apr 21 12:57:01 2014
New Revision: 206765
URL: http://llvm.org/viewvc/llvm-project?rev=206765&view=rev
Log:
CalcSpillWeights: Hack to prevent x87 nonsense
This gross hack forces `hweight` into memory, preventing hidden
precision from making `1 > 1` occasionally equal `true`.
<rdar://problem/14292693>
Modified:
llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp
Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=206765&r1=206764&r2=206765&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original)
+++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Mon Apr 21 12:57:01 2014
@@ -149,7 +149,11 @@ VirtRegAuxInfo::calculateSpillWeightAndH
unsigned hint = copyHint(mi, li.reg, tri, mri);
if (!hint)
continue;
- float hweight = Hint[hint] += weight;
+ // Force hweight onto the stack so that x86 doesn't add hidden precision,
+ // making the comparison incorrectly pass (i.e., 1 > 1 == true??).
+ //
+ // FIXME: we probably shouldn't use floats at all.
+ volatile float hweight = Hint[hint] += weight;
if (TargetRegisterInfo::isPhysicalRegister(hint)) {
if (hweight > bestPhys && mri.isAllocatable(hint))
bestPhys = hweight, hintPhys = hint;
More information about the llvm-commits
mailing list