[llvm-branch-commits] [llvm] [profcheck][SimplifyCFG] Propagate !prof from `switch` to `select` (PR #159645)
https://github.com/alanzhao1 commented: In general this patch LGTM. I noticed that one downside of using `-profcheck-weights-for-test` is that the original branch weights aren't in the test, so it's hard for me to understand how this change modifies the branch weights. https://github.com/llvm/llvm-project/pull/159645 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [SimplifyCFG][profcheck] Handle branch weights in `simplifySwitchLookup` (PR #161739)
https://github.com/alanzhao1 approved this pull request. https://github.com/llvm/llvm-project/pull/161739 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [SimplifyCFG][profcheck] Profile propagation for `indirectbr` (PR #161747)
@@ -8,15 +8,19 @@ declare void @A()
declare void @B(i32)
declare void @C()
-define void @indbrtest0(ptr %P, ptr %Q) {
+;.
+; CHECK: @anchor = constant [13 x ptr] [ptr blockaddress(@indbrtest3, %L1),
ptr blockaddress(@indbrtest3, %L2), ptr inttoptr (i32 1 to ptr), ptr
blockaddress(@indbrtest4, %L1), ptr inttoptr (i32 1 to ptr), ptr inttoptr (i32
1 to ptr), ptr inttoptr (i32 1 to ptr), ptr inttoptr (i32 1 to ptr), ptr
inttoptr (i32 1 to ptr), ptr inttoptr (i32 1 to ptr), ptr inttoptr (i32 1 to
ptr), ptr inttoptr (i32 1 to ptr), ptr inttoptr (i32 1 to ptr)]
+; CHECK: @xblkx.bbs = internal unnamed_addr constant [9 x ptr] [ptr
blockaddress(@indbrtest7, %xlab4x), ptr blockaddress(@indbrtest7, %xlab4x), ptr
blockaddress(@indbrtest7, %v2j), ptr blockaddress(@indbrtest7, %xlab4x), ptr
blockaddress(@indbrtest7, %xlab4x), ptr blockaddress(@indbrtest7, %xlab4x), ptr
blockaddress(@indbrtest7, %xlab4x), ptr blockaddress(@indbrtest7, %xlab4x), ptr
blockaddress(@indbrtest7, %v2j)]
+;.
+define void @indbrtest0(ptr %P, ptr %Q) !prof !0 {
; CHECK-LABEL: @indbrtest0(
; CHECK-NEXT: entry:
; CHECK-NEXT:store ptr blockaddress(@indbrtest0, [[BB0:%.*]]), ptr
[[P:%.*]], align 8
; CHECK-NEXT:store ptr blockaddress(@indbrtest0, [[BB1:%.*]]), ptr [[P]],
align 8
; CHECK-NEXT:store ptr blockaddress(@indbrtest0, [[BB2:%.*]]), ptr [[P]],
align 8
; CHECK-NEXT:call void @foo()
; CHECK-NEXT:[[T:%.*]] = load ptr, ptr [[Q:%.*]], align 8
-; CHECK-NEXT:indirectbr ptr [[T]], [label [[BB0]], label [[BB1]], label
%BB2]
+; CHECK-NEXT:indirectbr ptr [[T]], [label [[BB0]], label [[BB1]], label
%BB2], !prof [[PROF1:![0-9]+]]
alanzhao1 wrote:
Shouldn't the branch weights be summed grouped by destination instead of
dropped here?
If I understand correctly, the purpose of this transformation is to remove
redundant labels in indirectbr statements. As an example,
```
indirectbr ptr %foo [label %L1, label %L2, label %L1]
```
is simplified to
```
indirectbr ptr %foo [label %L1, label %L2]
```
Now assume in the original statement the weights are 1, 1, and 1. This implies
that `%L1` is twice as likely to be branched to compared to `%L2`. The
simplification removes redundant labels, but since nothing else gets changed,
shouldn't the branch weights be 2 and 1 instead of 1 and 1 as the instruction
is identical?
https://github.com/llvm/llvm-project/pull/161747
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [NFC] Leave a comment in `Local.cpp` about debug info & sample profiling (PR #155296)
https://github.com/alanzhao1 approved this pull request. https://github.com/llvm/llvm-project/pull/155296 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [IR] Add `MD_prof` to the `Keep` list of `dropUBImplyingAttrsAndMetadata` (PR #154635)
https://github.com/alanzhao1 approved this pull request. https://github.com/llvm/llvm-project/pull/154635 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [LSCFG][profcheck] Add dummy branch weights for the dummy switch to dead exits (PR #164714)
https://github.com/alanzhao1 approved this pull request. https://github.com/llvm/llvm-project/pull/164714 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [LIR][profcheck] Reuse the loop's exit condition profile (PR #164523)
https://github.com/alanzhao1 approved this pull request. https://github.com/llvm/llvm-project/pull/164523 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [SLU][profcheck] Use the original branch weigths in `buildPartialInvariantUnswitchConditionalBranch` (PR #164270)
https://github.com/alanzhao1 approved this pull request. https://github.com/llvm/llvm-project/pull/164270 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [SLU][profcheck] create likely branch weights for guard->branch (PR #164271)
https://github.com/alanzhao1 approved this pull request. https://github.com/llvm/llvm-project/pull/164271 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [LVer][profcheck] explicitly set unknown branch weights for the versioned/unversioned selector (PR #164507)
https://github.com/alanzhao1 approved this pull request. https://github.com/llvm/llvm-project/pull/164507 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
