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

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 17 08:40:01 PST 2017


hfinkel 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;
----------------
Carrot wrote:
> 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.
> 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.

Fair enough. As we both know, there are all sorts of issues affecting this, but I agree that for non-loop code with small basic blocks, this is likely true.  Please mention this assumption in the comment.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:539
+  // longer than DependenceChainLatency, then branch is better than select.
+  if (BB1_chain >= DependenceChainLatency)
+    return true;
----------------
Carrot wrote:
> 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. 
Please add this to the comment.


https://reviews.llvm.org/D39352





More information about the llvm-commits mailing list