[PATCH] D28593: Update loop branch_weight metadata after loop rotation.
Dehao Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 12 09:04:15 PST 2017
danielcdh added inline comments.
================
Comment at: test/Transforms/LoopRotate/loop-rotate-pgo.ll:60
+; CHECK: !0 = !{!"branch_weights", i32 28, i32 7}
+; CHECK: !1 = !{!"branch_weights", i32 7, i32 1}
+!0 = !{!"branch_weights", i32 35, i32 7}
----------------
I'm a little confused the logic here. For the following code:
L1:
if (cond) { // taken probability 7/35
stmt;
goto L1;
}
The loop rotate originally transforms it to:
if (cond) { // taken probability 7/35
L1:
stmt;
if (cond) { // taken probability 7/35
goto L1;
}
}
Your patch change it to:
if (cond) { // taken probability 7/28
L1:
stmt
if (cond) { // taken probability 1/7
goto L1;
}
}
Assuming "cond" has fixed taken probability, the original probability seems more correct to me? Or am I missing something?
https://reviews.llvm.org/D28593
More information about the llvm-commits
mailing list