[clang] 3b34d69 - Revert "For #64088: mark vtable as used if we might emit a reference to it."

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 6 21:27:51 PDT 2023


Ping on this - please always include details on the reason for a revert.

On Tue, Aug 1, 2023 at 10:09 AM Richard Smith via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> This revert reintroduces a wrong-code bug, can you explain what the
> purpose of the revert is?
>
> On Fri, 28 Jul 2023 at 03:50, Dmitry Chernenkov via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>>
>> Author: Dmitry Chernenkov
>> Date: 2023-07-28T10:49:53Z
>> New Revision: 3b34d69ac7a643742364be3591b324ddd14ef9aa
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/3b34d69ac7a643742364be3591b324ddd14ef9aa
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/3b34d69ac7a643742364be3591b324ddd14ef9aa.diff
>>
>> LOG: Revert "For #64088: mark vtable as used if we might emit a reference
>> to it."
>>
>> This reverts commit b6847edfc235829b37dd6d734ef5bbfa0a58b6fc.
>>
>> Added:
>>
>>
>> Modified:
>>     clang/lib/Sema/SemaCast.cpp
>>     clang/test/CodeGenCXX/dynamic-cast-exact.cpp
>>
>> Removed:
>>
>>
>>
>>
>> ################################################################################
>> diff  --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
>> index b338d601db7397..d65ecf52c52310 100644
>> --- a/clang/lib/Sema/SemaCast.cpp
>> +++ b/clang/lib/Sema/SemaCast.cpp
>> @@ -935,14 +935,6 @@ void CastOperation::CheckDynamicCast() {
>>            << isClangCL;
>>    }
>>
>> -  // For a dynamic_cast to a final type, IR generation might emit a
>> reference
>> -  // to the vtable.
>> -  if (DestRecord) {
>> -    auto *DestDecl = DestRecord->getAsCXXRecordDecl();
>> -    if (DestDecl->isEffectivelyFinal())
>> -      Self.MarkVTableUsed(OpRange.getBegin(), DestDecl);
>> -  }
>> -
>>    // Done. Everything else is run-time checks.
>>    Kind = CK_Dynamic;
>>  }
>>
>> diff  --git a/clang/test/CodeGenCXX/dynamic-cast-exact.cpp
>> b/clang/test/CodeGenCXX/dynamic-cast-exact.cpp
>> index bd283e85101b4b..676aa975a72686 100644
>> --- a/clang/test/CodeGenCXX/dynamic-cast-exact.cpp
>> +++ b/clang/test/CodeGenCXX/dynamic-cast-exact.cpp
>> @@ -76,12 +76,3 @@ H *exact_multi(A *a) {
>>    // CHECK: phi ptr [ %[[RESULT]], %[[LABEL_NOTNULL]] ], [ null,
>> %[[LABEL_FAILED]] ]
>>    return dynamic_cast<H*>(a);
>>  }
>> -
>> -namespace GH64088 {
>> -  // Ensure we mark the B vtable as used here, because we're going to
>> emit a
>> -  // reference to it.
>> -  // CHECK: define {{.*}} @_ZN7GH640881BD0
>> -  struct A { virtual ~A(); };
>> -  struct B final : A { virtual ~B() = default; };
>> -  B *cast(A *p) { return dynamic_cast<B*>(p); }
>> -}
>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230806/c884bc9d/attachment.html>


More information about the cfe-commits mailing list