[PATCH] D13223: Generate assume loads only with -fstrict-vtable-pointers
Piotr Padlewski via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 28 13:16:17 PDT 2015
Prazek created this revision.
Prazek added reviewers: rsmith, samsonov, majnemer.
Prazek added a subscriber: cfe-commits.
Temporary fix till InstCombine and other possible passes will be efficient to handle multiple assumes.
http://reviews.llvm.org/D13223
Files:
lib/CodeGen/CGClass.cpp
test/CodeGenCXX/vtable-assume-load.cpp
Index: test/CodeGenCXX/vtable-assume-load.cpp
===================================================================
--- test/CodeGenCXX/vtable-assume-load.cpp
+++ test/CodeGenCXX/vtable-assume-load.cpp
@@ -1,5 +1,6 @@
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o %t.ll -O1 -disable-llvm-optzns -fms-extensions
-// RUN: %clang_cc1 %s -triple i686-pc-win32 -emit-llvm -o %t.ms.ll -O1 -disable-llvm-optzns -fms-extensions
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o %t.ll -O1 -disable-llvm-optzns -fms-extensions -fstrict-vtable-pointers
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -emit-llvm -o %t.ms.ll -O1 -disable-llvm-optzns -fms-extensions -fstrict-vtable-pointers
+// FIXME: Assume load should not require -fstrict-vtable-pointers
// RUN: FileCheck --check-prefix=CHECK1 --input-file=%t.ll %s
// RUN: FileCheck --check-prefix=CHECK2 --input-file=%t.ll %s
Index: lib/CodeGen/CGClass.cpp
===================================================================
--- lib/CodeGen/CGClass.cpp
+++ lib/CodeGen/CGClass.cpp
@@ -2107,9 +2107,12 @@
// 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. Assumption loads requires -fstrict-vtable-pointers temporary.
if (CGM.getCodeGenOpts().OptimizationLevel > 0 &&
ClassDecl->isDynamicClass() && Type != Ctor_Base &&
- CGM.getCXXABI().canSpeculativelyEmitVTable(ClassDecl))
+ CGM.getCXXABI().canSpeculativelyEmitVTable(ClassDecl) &&
+ CGM.getCodeGenOpts().StrictVTablePointers)
EmitVTableAssumptionLoads(ClassDecl, This);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13223.35902.patch
Type: text/x-patch
Size: 1758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150928/0c9d9f40/attachment.bin>
More information about the cfe-commits
mailing list