From 8567fd2fe8a86e4799f27daa715adc8bc95b3282 Mon Sep 17 00:00:00 2001 From: Renato Golin Date: Thu, 1 Oct 2015 12:58:41 +0000 Subject: [PATCH] Revert "Decorating virtual functions load with invariant.load" and fix This reverts commit r248982 as it was breaking the ARM buildbots and the fix didn't work. This reverts commit r248984, the fix that didn't work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249005 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/ItaniumCXXABI.cpp | 11 +---------- test/CodeGenCXX/virtual-function-calls.cpp | 7 +------ 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index 37b49dc608..8392f6a7ba 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -1609,16 +1609,7 @@ llvm::Value *ItaniumCXXABI::getVirtualFunctionPointer(CodeGenFunction &CGF, uint64_t VTableIndex = CGM.getItaniumVTableContext().getMethodVTableIndex(GD); llvm::Value *VFuncPtr = CGF.Builder.CreateConstInBoundsGEP1_64(VTable, VTableIndex, "vfn"); - auto *Inst = CGF.Builder.CreateAlignedLoad(VFuncPtr, CGF.getPointerAlign()); - - // It's safe to add "invariant.load" without -fstrict-vtable-pointers, but it - // would not help in devirtualization. - if (CGM.getCodeGenOpts().OptimizationLevel > 0 && - CGM.getCodeGenOpts().StrictVTablePointers) - Inst->setMetadata(llvm::LLVMContext::MD_invariant_load, - llvm::MDNode::get(CGM.getLLVMContext(), - llvm::ArrayRef())); - return Inst; + return CGF.Builder.CreateAlignedLoad(VFuncPtr, CGF.getPointerAlign()); } llvm::Value *ItaniumCXXABI::EmitVirtualDestructorCall( diff --git a/test/CodeGenCXX/virtual-function-calls.cpp b/test/CodeGenCXX/virtual-function-calls.cpp index 76fc7bcf5c..0a6fc6b3f2 100644 --- a/test/CodeGenCXX/virtual-function-calls.cpp +++ b/test/CodeGenCXX/virtual-function-calls.cpp @@ -1,5 +1,4 @@ // RUN: %clang_cc1 %s -triple %itanium_abi_triple -std=c++11 -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 %s -triple %itanium_abi_triple -std=c++11 -emit-llvm -o - -fstrict-vtable-pointers -O1 | FileCheck --check-prefix=CHECK-INVARIANT %s // PR5021 namespace PR5021 { @@ -43,14 +42,10 @@ namespace VirtualNoreturn { [[noreturn]] virtual void f(); }; - // CHECK-LABEL: @_ZN15VirtualNoreturn1f - // CHECK-INVARIANT-LABEL: define void @_ZN15VirtualNoreturn1f + // CHECK: @_ZN15VirtualNoreturn1f void f(A *p) { p->f(); // CHECK: call {{.*}}void %{{[^#]*$}} // CHECK-NOT: unreachable - // CHECK-INVARIANT: load {{.*}} !invariant.load ![[EMPTY_NODE:[0-9]]] } } - -// CHECK-INVARIANT: ![[EMPTY_NODE]] = !{} -- 2.40.0