https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/241643
>From ad4ad614dd5947338642adbf80f3b7662bccdcbd Mon Sep 17 00:00:00 2001 From: Vitaly Buka <[email protected]> Date: Wed, 11 Nov 2026 19:05:39 -0800 Subject: [PATCH 1/2] [spr] update Created using spr 2.0.0-beta.2 --- clang/lib/CodeGen/CGClass.cpp | 5 ++--- clang/test/CodeGenCXX/cfi-vtable-check.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 00bc1eb0848d4..a1b61394571d4 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -2980,9 +2980,8 @@ void CodeGenFunction::EmitVTableCheck(CFITypeCheckKind TCK, CanQualType T, } bool CodeGenFunction::ShouldEmitVTableTypeCheckedLoad(const CXXRecordDecl *RD) { - if ((!CGM.getCodeGenOpts().WholeProgramVTables || - !CGM.HasHiddenLTOVisibility(RD)) && - !CGM.getCodeGenOpts().DevirtualizeSpeculatively) + if (!CGM.getCodeGenOpts().WholeProgramVTables || + !CGM.HasHiddenLTOVisibility(RD)) return false; if (CGM.getCodeGenOpts().VirtualFunctionElimination) diff --git a/clang/test/CodeGenCXX/cfi-vtable-check.cpp b/clang/test/CodeGenCXX/cfi-vtable-check.cpp index 46c4b2f935044..47e8d7130e7ba 100644 --- a/clang/test/CodeGenCXX/cfi-vtable-check.cpp +++ b/clang/test/CodeGenCXX/cfi-vtable-check.cpp @@ -80,15 +80,15 @@ struct S { // SPEC_TRAP-NEXT: store ptr [[S]], ptr [[S_ADDR]], align 8 // SPEC_TRAP-NEXT: [[TMP0:%.*]] = load ptr, ptr [[S_ADDR]], align 8 // SPEC_TRAP-NEXT: [[VTABLE:%.*]] = load ptr, ptr [[TMP0]], align 8 -// SPEC_TRAP-NEXT: [[TMP1:%.*]] = call { ptr, i1 } @llvm.type.checked.load(ptr [[VTABLE]], i32 0, metadata !"_ZTS1S"), !nosanitize [[META1:![0-9]+]] -// SPEC_TRAP-NEXT: [[TMP2:%.*]] = extractvalue { ptr, i1 } [[TMP1]], 1, !nosanitize [[META1]] -// SPEC_TRAP-NEXT: br i1 [[TMP2]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF2:![0-9]+]], !nosanitize [[META1]] +// SPEC_TRAP-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[VTABLE]], metadata !"_ZTS1S"), !nosanitize [[META1:![0-9]+]] +// SPEC_TRAP-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !prof [[PROF2:![0-9]+]], !nosanitize [[META1]] // SPEC_TRAP: [[TRAP]]: // SPEC_TRAP-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !nosanitize [[META1]] // SPEC_TRAP-NEXT: unreachable, !nosanitize [[META1]] // SPEC_TRAP: [[CONT]]: -// SPEC_TRAP-NEXT: [[TMP3:%.*]] = extractvalue { ptr, i1 } [[TMP1]], 0, !nosanitize [[META1]] -// SPEC_TRAP-NEXT: call void [[TMP3]](ptr noundef nonnull align 8 dereferenceable(8) [[TMP0]]) +// SPEC_TRAP-NEXT: [[VFN:%.*]] = getelementptr inbounds ptr, ptr [[VTABLE]], i64 0 +// SPEC_TRAP-NEXT: [[TMP2:%.*]] = load ptr, ptr [[VFN]], align 8 +// SPEC_TRAP-NEXT: call void [[TMP2]](ptr noundef nonnull align 8 dereferenceable(8) [[TMP0]]) // SPEC_TRAP-NEXT: ret void // extern "C" void test(S *s) { @@ -115,7 +115,7 @@ extern "C" void test(S *s) { // XDSO_TRAP: attributes #[[ATTR6:[0-9]+]] = { nomerge noreturn nounwind } //. // SPEC_TRAP: attributes #[[ATTR0]] = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } -// SPEC_TRAP: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(none) } +// SPEC_TRAP: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } // SPEC_TRAP: attributes #[[ATTR2:[0-9]+]] = { cold noreturn nounwind memory(inaccessiblemem: write) } // SPEC_TRAP: attributes #[[ATTR3]] = { nomerge noreturn nounwind } //. >From 30c518686b46eb35a851e27135edaad93006600a Mon Sep 17 00:00:00 2001 From: Vitaly Buka <[email protected]> Date: Thu, 12 Nov 2026 15:42:31 -0800 Subject: [PATCH 2/2] Rebase Created using spr 2.0.0-beta.2 --- compiler-rt/test/cfi/devirtualize-speculatively.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/compiler-rt/test/cfi/devirtualize-speculatively.cpp b/compiler-rt/test/cfi/devirtualize-speculatively.cpp index 92fd71ee7494b..7cc258f07751d 100644 --- a/compiler-rt/test/cfi/devirtualize-speculatively.cpp +++ b/compiler-rt/test/cfi/devirtualize-speculatively.cpp @@ -6,9 +6,6 @@ // public LTO visibility: their vtables may come from outside of the LTO unit, // like the one defined in a non-LTO object here. -// FIXME: The checked load traps on the vtable from the non-LTO object. -// XFAIL: * - struct [[clang::lto_visibility_public]] A { virtual void f(); }; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
