https://gcc.gnu.org/g:83b3c80fac333c429d0d8a9f58d3d494c2ba305f

commit r16-6590-g83b3c80fac333c429d0d8a9f58d3d494c2ba305f
Author: Kugan Vivekanandarajah <[email protected]>
Date:   Fri Jan 9 11:59:27 2026 +1100

    [Bug gcov-profile/123019][V3] Fix Virtual SSA ICE
    
    The bug is a stale Virtual SSA VDEF on calls to functions that have
    been marked const or pure.
    
    pure_const pass analyzes function rocksdb::y::y() and determines it has no 
side
    effects and marks it as const.
    
    At this point, existing call sites to y::y() in other functions still have:
       # .MEM_12 = VDEF <.MEM_11>   rocksdb::y::y (&l, _9);
    The VDEF indicates the call modifies memory but now that y::y() is const,
    this VDEF is stale
    
    Later passes  after feedback_fnsplit SSA verification fails. Added fixup.
    
    gcc/ChangeLog:
    
    2026-01-07  Kugan Vivekanandarajah  <[email protected]>
    
            PR gcov-profile/123019
            * auto-profile.cc (auto_profile): Call execute_fixup_cfg.
    
    Signed-off-by: Kugan Vivekanandarajah <[email protected]>

Diff:
---
 gcc/auto-profile.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index 06ea4015251a..2434936a0a6c 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -4567,6 +4567,11 @@ auto_profile (void)
 
     push_cfun (DECL_STRUCT_FUNCTION (node->decl));
 
+    /* Local pure-const may imply need to fixup the cfg.
+       This is similar to what is done in tree-profile.cc.  */
+    if ((execute_fixup_cfg () & TODO_cleanup_cfg))
+      cleanup_tree_cfg ();
+
     autofdo::afdo_annotate_cfg ();
     compute_function_frequency ();

Reply via email to