diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-04-21 17:57:01 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-04-21 17:57:01 +0000 |
commit | 7af3432e22b04522b63b159f0a07b2e9c4274a4a (patch) | |
tree | 001a62255ab5d9dae9e14b2dae6f6ff7434a0435 /llvm/lib/CodeGen | |
parent | b96ca6b0c8014477422196abbc350a3fef1e4ac5 (diff) | |
download | bcm5719-llvm-7af3432e22b04522b63b159f0a07b2e9c4274a4a.tar.gz bcm5719-llvm-7af3432e22b04522b63b159f0a07b2e9c4274a4a.zip |
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>
llvm-svn: 206765
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/CalcSpillWeights.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CalcSpillWeights.cpp b/llvm/lib/CodeGen/CalcSpillWeights.cpp index e4d5fa80ca3..2654f42d2c6 100644 --- a/llvm/lib/CodeGen/CalcSpillWeights.cpp +++ b/llvm/lib/CodeGen/CalcSpillWeights.cpp @@ -149,7 +149,11 @@ VirtRegAuxInfo::calculateSpillWeightAndHint(LiveInterval &li) { 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; |