[all-commits] [llvm/llvm-project] 222de7: [X86CmovConversion] Make heuristic for optimized c...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Feb 19 05:06:20 PST 2020


  Branch: refs/heads/release/10.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 222de784df453659144c6d07b530e7858c980021
      https://github.com/llvm/llvm-project/commit/222de784df453659144c6d07b530e7858c980021
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-02-19 (Wed, 19 Feb 2020)

  Changed paths:
    M llvm/lib/Target/X86/X86CmovConversion.cpp

  Log Message:
  -----------
  [X86CmovConversion] Make heuristic for optimized cmov depth more conservative (PR44539)

Fix/workaround for https://bugs.llvm.org/show_bug.cgi?id=44539.
As discussed there, this pass makes some overly optimistic
assumptions, as it does not have access to actual branch weights.

This patch makes the computation of the depth of the optimized cmov
more conservative, by assuming a distribution of 75/25 rather than
50/50 and placing the weights to get the more conservative result
(larger depth). The fully conservative choice would be
std::max(TrueOpDepth, FalseOpDepth), but that would break at least
one existing test (which may or may not be an issue in practice).

Differential Revision: https://reviews.llvm.org/D74155

(cherry picked from commit 5eb19bf4a2b0c29a8d4d48dfb0276f096eff9bec)




More information about the All-commits mailing list