diff options
author | Richard Biener <rguenther@suse.de> | 2023-12-04 14:50:59 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-12-04 15:33:58 +0100 |
commit | 0c2ea80a4ffbddc0bc29f5badaf2ae43e59483b2 (patch) | |
tree | 3eea2dce78a72ebb27d6791572b485a8f6db7b82 /gcc/function.h | |
parent | 82576a6e77e0a284975dda87efe4b2d5bc5b9b1c (diff) | |
download | gcc-0c2ea80a4ffbddc0bc29f5badaf2ae43e59483b2.zip gcc-0c2ea80a4ffbddc0bc29f5badaf2ae43e59483b2.tar.gz gcc-0c2ea80a4ffbddc0bc29f5badaf2ae43e59483b2.tar.bz2 |
middle-end/112785 - guard against last_clique overflow
The PR shows that we'll ICE eventually when last_clique wraps. The
following avoids this by refusing to hand out new cliques after
exhausting them. We then use zero (no clique) as conservative
fallback.
PR middle-end/112785
* function.h (get_new_clique): New inline function handling
last_clique overflow.
* cfgrtl.cc (duplicate_insn_chain): Use it.
* tree-cfg.cc (gimple_duplicate_bb): Likewise.
* tree-inline.cc (remap_dependence_clique): Likewise.
Diffstat (limited to 'gcc/function.h')
-rw-r--r-- | gcc/function.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/function.h b/gcc/function.h index 2984656..833c35e 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -518,6 +518,17 @@ set_loops_for_fn (struct function *fn, struct loops *loops) fn->x_current_loops = loops; } +/* Get a new unique dependence clique or zero if none is left. */ + +inline unsigned short +get_new_clique (function *fn) +{ + unsigned short clique = fn->last_clique + 1; + if (clique != 0) + fn->last_clique = clique; + return clique; +} + /* For backward compatibility... eventually these should all go away. */ #define current_function_funcdef_no (cfun->funcdef_no) |