Skip to content

Commit c8e5ad4

Browse files
committed
Revert "[TBAA] Add verifier for tbaa.struct metadata (#86709)"
This reverts commit 7dbba39. Revert as there are reports this triggers during ThinLTO in some configurations.
1 parent 821935b commit c8e5ad4

File tree

9 files changed

+9
-54
lines changed

9 files changed

+9
-54
lines changed

llvm/include/llvm/IR/Verifier.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class TBAAVerifier {
7777
/// Visit an instruction and return true if it is valid, return false if an
7878
/// invalid TBAA is attached.
7979
bool visitTBAAMetadata(Instruction &I, const MDNode *MD);
80-
bool visitTBAAStructMetadata(Instruction &I, const MDNode *MD);
8180
};
8281

8382
/// Check a function for errors, useful for use when debugging a

llvm/lib/IR/Verifier.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5123,9 +5123,6 @@ void Verifier::visitInstruction(Instruction &I) {
51235123
if (MDNode *TBAA = I.getMetadata(LLVMContext::MD_tbaa))
51245124
TBAAVerifyHelper.visitTBAAMetadata(I, TBAA);
51255125

5126-
if (MDNode *TBAA = I.getMetadata(LLVMContext::MD_tbaa_struct))
5127-
TBAAVerifyHelper.visitTBAAStructMetadata(I, TBAA);
5128-
51295126
if (MDNode *MD = I.getMetadata(LLVMContext::MD_noalias))
51305127
visitAliasScopeListMetadata(MD);
51315128
if (MDNode *MD = I.getMetadata(LLVMContext::MD_alias_scope))
@@ -7462,35 +7459,6 @@ bool TBAAVerifier::visitTBAAMetadata(Instruction &I, const MDNode *MD) {
74627459
return true;
74637460
}
74647461

7465-
bool TBAAVerifier::visitTBAAStructMetadata(Instruction &I, const MDNode *MD) {
7466-
CheckTBAA(MD->getNumOperands() % 3 == 0,
7467-
"tbaa.struct operands must occur in groups of three", &I, MD);
7468-
7469-
// Each group of three operands must consist of two integers and a
7470-
// tbaa node. Moreover, the regions described by the offset and size
7471-
// operands must be non-overlapping.
7472-
std::optional<APInt> NextFree;
7473-
for (unsigned int Idx = 0; Idx < MD->getNumOperands(); Idx += 3) {
7474-
auto *OffsetCI =
7475-
mdconst::dyn_extract_or_null<ConstantInt>(MD->getOperand(Idx));
7476-
CheckTBAA(OffsetCI, "Offset must be a constant integer", &I, MD);
7477-
7478-
auto *SizeCI =
7479-
mdconst::dyn_extract_or_null<ConstantInt>(MD->getOperand(Idx + 1));
7480-
CheckTBAA(SizeCI, "Size must be a constant integer", &I, MD);
7481-
7482-
MDNode *TBAA = dyn_cast_or_null<MDNode>(MD->getOperand(Idx + 2));
7483-
CheckTBAA(TBAA, "TBAA tag missing", &I, MD);
7484-
visitTBAAMetadata(I, TBAA);
7485-
7486-
bool NonOverlapping = !NextFree || NextFree->ule(OffsetCI->getValue());
7487-
CheckTBAA(NonOverlapping, "Overlapping tbaa.struct regions", &I, MD);
7488-
7489-
NextFree = OffsetCI->getValue() + SizeCI->getValue();
7490-
}
7491-
return true;
7492-
}
7493-
74947462
char VerifierLegacyPass::ID = 0;
74957463
INITIALIZE_PASS(VerifierLegacyPass, "verify", "Module Verifier", false, false)
74967464

llvm/test/CodeGen/AArch64/arm64-abi_align.ll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,4 @@ attributes #5 = { nobuiltin }
518518
!1 = !{!"omnipotent char", !2}
519519
!2 = !{!"Simple C/C++ TBAA"}
520520
!3 = !{!"short", !1}
521-
!4 = !{i64 0, i64 4, !5, i64 4, i64 2, !6, i64 8, i64 4, !5, i64 12, i64 2, !6, i64 16, i64 4, !5, i64 20, i64 2, !6}
522-
!5 = !{!0, !0, i64 0}
523-
!6 = !{!3, !3, i64 0}
521+
!4 = !{i64 0, i64 4, !0, i64 4, i64 2, !3, i64 8, i64 4, !0, i64 12, i64 2, !3, i64 16, i64 4, !0, i64 20, i64 2, !3}

llvm/test/Transforms/InferAddressSpaces/AMDGPU/mem-intrinsics.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@ attributes #1 = { argmemonly nounwind }
141141
!5 = distinct !{!5, !"some domain"}
142142
!6 = !{!7}
143143
!7 = distinct !{!7, !5, !"some scope 2"}
144-
!8 = !{i64 0, i64 8, !0}
144+
!8 = !{i64 0, i64 8, null}

llvm/test/Transforms/InstCombine/struct-assign-tbaa.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ entry:
7575
!1 = !{!"omnipotent char", !0}
7676
!2 = !{!5, !5, i64 0}
7777
!3 = !{i64 0, i64 4, !2}
78-
!4 = !{i64 0, i64 8, !2}
78+
!4 = !{i64 0, i64 8, null}
7979
!5 = !{!"float", !0}
8080
!6 = !{i64 0, i64 4, !2, i64 4, i64 4, !2}
8181
!7 = !{i64 0, i64 2, !2, i64 4, i64 6, !2}

llvm/test/Transforms/SROA/tbaa-struct3.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias
539539
!6 = !{!5, !5, i64 0}
540540
!7 = !{i64 0, i64 8, !6, i64 8, i64 4, !1}
541541
!8 = !{i64 0, i64 4, !1, i64 4, i64 8, !6}
542-
!9 = !{i64 0, i64 8, !6, i64 8, i64 8, !1}
542+
!9 = !{i64 0, i64 8, !6, i64 4, i64 8, !1}
543543
!10 = !{i64 0, i64 2, !1, i64 2, i64 2, !1}
544544
!11 = !{i64 0, i64 1, !1, i64 1, i64 3, !1}
545545
!12 = !{i64 0, i64 2, !1, i64 2, i64 6, !1}

llvm/test/Transforms/Scalarizer/basic-inseltpoison.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,5 @@ define <2 x i32> @f23_crash(<2 x i32> %srcvec, i32 %v1) {
836836
!2 = !{ !"set2", !0 }
837837
!3 = !{ !3, !{!"llvm.loop.parallel_accesses", !13} }
838838
!4 = !{ float 4.0 }
839-
!5 = !{ i64 0, i64 8, !6 }
840-
!6 = !{ !1, !1, i64 0 }
839+
!5 = !{ i64 0, i64 8, null }
841840
!13 = distinct !{}

llvm/test/Transforms/Scalarizer/basic.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,5 @@ define <2 x i8> @test_copy_trunc_flags(<2 x i32> %src) {
884884
!2 = !{ !"set2", !0 }
885885
!3 = !{ !3, !{!"llvm.loop.parallel_accesses", !13} }
886886
!4 = !{ float 4.0 }
887-
!5 = !{ i64 0, i64 8, !6 }
888-
!6 = !{ !1, !1, i64 0 }
887+
!5 = !{ i64 0, i64 8, null }
889888
!13 = distinct !{}

llvm/test/Verifier/tbaa-struct.ll

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
1-
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
1+
; RUN: llvm-as < %s 2>&1
2+
3+
; FIXME: The verifer should reject the invalid !tbaa.struct nodes below.
24

35
define void @test_overlapping_regions(ptr %a1) {
4-
; CHECK: Overlapping tbaa.struct regions
5-
; CHECK-NEXT: %ld = load i8, ptr %a1, align 1, !tbaa.struct !0
66
%ld = load i8, ptr %a1, align 1, !tbaa.struct !0
77
ret void
88
}
99

1010
define void @test_size_not_integer(ptr %a1) {
11-
; CHECK: Size must be a constant integer
12-
; CHECK-NEXT: store i8 1, ptr %a1, align 1, !tbaa.struct !5
1311
store i8 1, ptr %a1, align 1, !tbaa.struct !5
1412
ret void
1513
}
1614

1715
define void @test_offset_not_integer(ptr %a1, ptr %a2) {
18-
; CHECK: Offset must be a constant integer
19-
; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %a1, ptr align 8 %a2, i64 16, i1 false), !tbaa.struct !6
2016
tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %a1, ptr align 8 %a2, i64 16, i1 false), !tbaa.struct !6
2117
ret void
2218
}
2319

2420
define void @test_tbaa_missing(ptr %a1, ptr %a2) {
25-
; CHECK: TBAA tag missing
26-
; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %a1, ptr align 8 %a2, i64 16, i1 false), !tbaa.struct !7
2721
tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %a1, ptr align 8 %a2, i64 16, i1 false), !tbaa.struct !7
2822
ret void
2923
}
3024

3125
define void @test_tbaa_invalid(ptr %a1) {
32-
; CHECK: Old-style TBAA is no longer allowed, use struct-path TBAA instead
33-
; CHECK-NEXT: store i8 1, ptr %a1, align 1, !tbaa.struct !8
3426
store i8 1, ptr %a1, align 1, !tbaa.struct !8
3527
ret void
3628
}

0 commit comments

Comments
 (0)