[PATCH] D17553: [SimplifyCFG] Speculatively flatten CFG based on profiling metadata (try 2)
David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 23 23:00:17 PST 2016
davidxl added a subscriber: davidxl.
davidxl added a comment.
It is probably worthwhile to have a more general transformation to reduce control dependence height by using logical/bitwise and|or operation:
br (cond1) fail1
check2:
br (cond2) fail2
label:
..
if cond2's computation can be safely control speculated, it becomes
br ( (cond1 == 0) & (cond2 == 0)) label;
dispatch:
br (cond1) fail1
br fail1
label:
Note that (cond1 == 0 & cond2 == 0) can be simplified in many cases (e.g, in the example test cases).
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:2689
@@ +2688,3 @@
+/// in_bounds:
+/// br (6 > Length), in_bounds2, fail2
+/// in_bounds2:
----------------
Should these two conditions swapped in this example or change > to < ?
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:2708
@@ +2707,3 @@
+ /// Is the failing path of this branch taken rarely if at all?
+ auto isRarelyUntaken = [](BranchInst *BI) {
+ uint64_t ProbTrue;
----------------
sanjoy wrote:
> Nit: should be `IsRarelyUntaken`.
How about IsLikelyTaken?
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:2721
@@ +2720,3 @@
+
+ // TODO: The following code performs a similiar, but slightly distinct
+ // transformation to that done by SpeculativelyExecuteBB. We should consider
----------------
nit: similar.
http://reviews.llvm.org/D17553
More information about the llvm-commits
mailing list