[clang] [TBAA] Correctly specify path to base type for aggregate assignment (PR #198590)

Florian Drescher via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 6 01:10:27 PST 2026


================
@@ -34,26 +34,15 @@ struct S s;
 // CHECK-LABEL: define dso_local void @f(
 // CHECK-SAME: <1 x i8> [[X:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
 // CHECK-NEXT:  [[ENTRY:.*:]]
-// CHECK-NEXT:    store <1 x i8> [[X]], ptr @s, align 1, !tbaa [[__MFP8_TBAA6:![0-9]+]]
+// CHECK-NEXT:    store <1 x i8> [[X]], ptr @s, align 1
----------------
Dudeldu wrote:

I looked into the root cause for this disappearing tbaa info... and this is a bit more involved. It seems that SROA drops "advanced" tbaa info (all tbaa info, where the type path is longer than one; refer https://github.com/llvm/llvm-project/blob/577bf515c84ab419ed043bee47c787e4f260b2f5/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp#L804
This likely also affects other passes. Therefore, improving the tbaa information at this point might have some bad consequences; this makes me doubt whether my suggested change is actually worthwhile - although it improves tbaa quality at this point (making it "more correct")
Interestingly enough, my original example would also be "fixed" with "-Xclang -new-struct-path-tbaa", so maybe it's better to actually work towards making this the default?

https://github.com/llvm/llvm-project/pull/198590


More information about the cfe-commits mailing list