aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfg.h
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2023-08-02 09:25:12 +0200
committerJan Hubicka <jh@suse.cz>2023-08-02 09:25:12 +0200
commit2e93b92c1ec5fbbbe10765c6e059c3c90d564245 (patch)
tree2558f4a90e7cc2573f35a274dc5628097a964479 /gcc/cfg.h
parent07b7cd70399d22c113ad8bb1eff5cc2d12973d33 (diff)
downloadgcc-2e93b92c1ec5fbbbe10765c6e059c3c90d564245.zip
gcc-2e93b92c1ec5fbbbe10765c6e059c3c90d564245.tar.gz
gcc-2e93b92c1ec5fbbbe10765c6e059c3c90d564245.tar.bz2
Fix profile update after cancelled loop distribution
Loop distribution and ifcvt introduces verisons of loops which may be removed later if vectorization fails. Ifcvt does this by temporarily breaking profile and producing conditional that has two arms with 100% probability because we know one of the versions will be removed. Loop distribution is trickier, since it introduces test for alignment that either survives to final code if vecotorization suceeds or is turned if it fails. Here we need to assign some reasonable probabilities for the case vectorization goes well, so this code adds logic to scale profile back in case we remove the call. This is not perfect since we drop precise BB counts to guessed. It is not big deal since we do not use much reliablity of bb counts after this point. Other option would be to apply scale only if vectorization succeeds which however needs bit more work at tree-loop-distribution side and would need all code in this patch with small change that fold_loop_internal_call will have to know how to adjust if conditional stays. I decided to go for easier solution for now. Bootstrapped/regtested x86_64-linux, committed. gcc/ChangeLog: * cfg.cc (scale_strictly_dominated_blocks): New function. * cfg.h (scale_strictly_dominated_blocks): Declare. * tree-cfg.cc (fold_loop_internal_call): Fixup CFG profile. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr98308.c: Check that profile is consistent.
Diffstat (limited to 'gcc/cfg.h')
-rw-r--r--gcc/cfg.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cfg.h b/gcc/cfg.h
index 4bf4263..a0e9449 100644
--- a/gcc/cfg.h
+++ b/gcc/cfg.h
@@ -127,6 +127,8 @@ extern void set_bb_copy (basic_block, basic_block);
extern basic_block get_bb_copy (basic_block);
void set_loop_copy (class loop *, class loop *);
class loop *get_loop_copy (class loop *);
+void scale_strictly_dominated_blocks (basic_block,
+ profile_count, profile_count);
/* Generic RAII class to allocate a bit from storage of integer type T.
The allocated bit is accessible as mask with the single bit set