r248734 - Generate assume loads only with -fstrict-vtable-pointers
Piotr Padlewski via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 28 13:30:25 PDT 2015
Author: prazek
Date: Mon Sep 28 15:30:22 2015
New Revision: 248734
URL: http://llvm.org/viewvc/llvm-project?rev=248734&view=rev
Log:
Generate assume loads only with -fstrict-vtable-pointers
Temporary fix till InstCombine and other possible passes will be
efficient to handle multiple assumes.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/test/CodeGenCXX/vtable-assume-load.cpp
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=248734&r1=248733&r2=248734&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Mon Sep 28 15:30:22 2015
@@ -2107,9 +2107,12 @@ void CodeGenFunction::EmitCXXConstructor
// 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.getCXXABI().canSpeculativelyEmitVTable(ClassDecl) &&
+ CGM.getCodeGenOpts().StrictVTablePointers)
EmitVTableAssumptionLoads(ClassDecl, This);
}
Modified: cfe/trunk/test/CodeGenCXX/vtable-assume-load.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-assume-load.cpp?rev=248734&r1=248733&r2=248734&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-assume-load.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/vtable-assume-load.cpp Mon Sep 28 15:30:22 2015
@@ -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
More information about the cfe-commits
mailing list