[clang] Revert "[CodeGen] Emit vtable assumptions without requiring -fstrict-vtable-pointers" (PR #91900)
via cfe-commits
cfe-commits at lists.llvm.org
Sun May 12 13:51:08 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: AtariDreams (AtariDreams)
<details>
<summary>Changes</summary>
This was supposed to be a temporary measure, but unfortunately as things tend to go in software development, temporary measures become permanent.
In the 9 years since then, we have greatly improved the way InstCombine works with assumes.
So, let's not make assumption loads require -fstrict-vtable-pointers.
---
Full diff: https://github.com/llvm/llvm-project/pull/91900.diff
2 Files Affected:
- (modified) clang/lib/CodeGen/CGClass.cpp (+1-4)
- (modified) clang/test/CodeGenCXX/vtable-assume-load.cpp (+2-3)
``````````diff
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index b3077292f4a20..70f57ff8688f7 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -2258,12 +2258,9 @@ void CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D,
// FIXME: If vtable is used by ctor/dtor, or if vtable is external and we are
// sure that definition of vtable is not hidden,
// then we are always safe to refer to it.
- // FIXME: It looks like InstCombine is very inefficient on dealing with
- // assumes. Make assumption loads require -fstrict-vtable-pointers temporarily.
if (CGM.getCodeGenOpts().OptimizationLevel > 0 &&
ClassDecl->isDynamicClass() && Type != Ctor_Base &&
- CGM.getCXXABI().canSpeculativelyEmitVTable(ClassDecl) &&
- CGM.getCodeGenOpts().StrictVTablePointers)
+ CGM.getCXXABI().canSpeculativelyEmitVTable(ClassDecl))
EmitVTableAssumptionLoads(ClassDecl, This);
}
diff --git a/clang/test/CodeGenCXX/vtable-assume-load.cpp b/clang/test/CodeGenCXX/vtable-assume-load.cpp
index 6ce07d0db1b15..c48fc71ccea87 100644
--- a/clang/test/CodeGenCXX/vtable-assume-load.cpp
+++ b/clang/test/CodeGenCXX/vtable-assume-load.cpp
@@ -1,6 +1,5 @@
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o %t.ll -O1 -disable-llvm-passes -fms-extensions -fstrict-vtable-pointers
-// RUN: %clang_cc1 %s -triple i686-pc-win32 -emit-llvm -o %t.ms.ll -O1 -disable-llvm-passes -fms-extensions -fstrict-vtable-pointers
-// FIXME: Assume load should not require -fstrict-vtable-pointers
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o %t.ll -O1 -disable-llvm-passes -fms-extensions
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -emit-llvm -o %t.ms.ll -O1 -disable-llvm-passes -fms-extensions
// RUN: FileCheck --check-prefix=CHECK1 --input-file=%t.ll %s
// RUN: FileCheck --check-prefix=CHECK2 --input-file=%t.ll %s
``````````
</details>
https://github.com/llvm/llvm-project/pull/91900
More information about the cfe-commits
mailing list