]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end/111591 - explain why TBAA doesn't need adjustment
authorRichard Biener <rguenther@suse.de>
Wed, 13 Dec 2023 07:54:49 +0000 (08:54 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 13 Dec 2023 07:59:01 +0000 (08:59 +0100)
While tidying the prototype patch I've done for the reduced testcase
in PR111591 and in that process trying to produce a testcase that
is miscompiled by stack slot coalescing and the TBAA info that
remains un-altered I've realized we do not need to adjust TBAA info.

The following documents this in the place we adjust points-to info
which we do need to adjust.

PR middle-end/111591
* cfgexpand.cc (update_alias_info_with_stack_vars): Document
why not adjusting TBAA info on accesses is OK.

gcc/cfgexpand.cc

index b860be8bb77b84357a439e6b25734e285fd8b418..ec887ef918f24f21c10704efba0eaf973499f019 100644 (file)
@@ -786,7 +786,13 @@ add_partitioned_vars_to_ptset (struct pt_solution *pt,
 /* Update points-to sets based on partition info, so we can use them on RTL.
    The bitmaps representing stack partitions will be saved until expand,
    where partitioned decls used as bases in memory expressions will be
-   rewritten.  */
+   rewritten.
+
+   It is not necessary to update TBAA info on accesses to the coalesced
+   storage since our memory model doesn't allow TBAA to be used for
+   WAW or WAR dependences.  For RAW when the write is to an old object
+   the new object would not have been initialized at the point of the
+   read, invoking undefined behavior.  */
 
 static void
 update_alias_info_with_stack_vars (void)