This is an archive of the discontinued LLVM Phabricator instance.

[X86] Consider branch probability in avoiding Store Forward Block
Needs ReviewPublic

Authored by shwqf on Sep 26 2022, 9:19 PM.

Details

Summary

Packed memory accesses may be broken because of predecessors, no matter how low the branch probabilities are.

This patch tries to fix two unprofitable cases:

a) Potential blockers from low-branch-probability predecessor.

b) Potential blockers from the block itself (a short self loop), memory address may change in each iteration.

Diff Detail

Event Timeline

shwqf created this revision.Sep 26 2022, 9:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 26 2022, 9:19 PM
shwqf requested review of this revision.Sep 26 2022, 9:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 26 2022, 9:19 PM
pengfei added inline comments.Sep 26 2022, 11:31 PM
llvm/test/CodeGen/X86/avoid-sfb-g-no-change3.mir
211–222

The test looks not affected by this patch. Should exclude it to reduce the noise?

llvm/test/CodeGen/X86/avoid-sfb.ll
2–5

We can merge the checks by providing a common prefix. e.g.:

-check-prefixes=SSE,CHECK
-check-prefixes=SSE,DISABLED
-check-prefixes=AVX,CHECK-AVX2
-check-prefixes=AVX,CHECK-AVX512
23–24

Are these changes in this file expected? I'm not sure where's the branch probability from and whether it makes sense or not.

shwqf updated this revision to Diff 463144.Sep 27 2022, 1:27 AM

a) refine avoid-sfb.ll
b) revert avoid-sfb-g-no-change3.mir

Matt added a subscriber: Matt.Sep 27 2022, 11:37 AM
RKSimon added inline comments.Oct 26 2022, 3:09 AM
llvm/test/CodeGen/X86/avoid-sfb.ll
1371

looks like you can remove these check-prefixes