[PATCH] D39352: [SimplifyCFG] Don't do if-conversion if there is a long dependence chain

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 10:16:36 PST 2017


Carrot added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:528
+  // latency of the dependence chain.
+  if ((BB1_chain + BB2_chain) * 2 <= New_BB_size)
+    return false;
----------------
hfinkel wrote:
> Should this 2 be the SchedModel's IssueWidth?
In real world applications, an IPC of 2 is already very good for 3 issue or 4 issue processors. Higher IPC is usually found in programs with small kernel. So I think 2 is more reasonable for most applications.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:539
+  // longer than DependenceChainLatency, then branch is better than select.
+  if (BB1_chain >= DependenceChainLatency)
+    return true;
----------------
hfinkel wrote:
> Is there a way to think of the proper value of DependenceChainLatency in terms of the branch-misprediction penalty?
DependenceChainLatency depends on many factors, besides branch misprediction penalty, there are also taken branch latency, branch mis prediction rate, cmov latency. 


https://reviews.llvm.org/D39352





More information about the llvm-commits mailing list