]> granicus.if.org Git - clang/commitdiff
Revert "Decorating virtual functions load with invariant.load" and fix
authorRenato Golin <renato.golin@linaro.org>
Thu, 1 Oct 2015 12:58:41 +0000 (12:58 +0000)
committerRenato Golin <renato.golin@linaro.org>
Thu, 1 Oct 2015 12:58:41 +0000 (12:58 +0000)
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
test/CodeGenCXX/virtual-function-calls.cpp

index 37b49dc6086e290941f1e4478e34da97030f3f60..8392f6a7ba2e1cd709ab606653d1080e1181d94a 100644 (file)
@@ -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<llvm::Metadata *>()));
-  return Inst;
+  return CGF.Builder.CreateAlignedLoad(VFuncPtr, CGF.getPointerAlign());
 }
 
 llvm::Value *ItaniumCXXABI::EmitVirtualDestructorCall(
index 76fc7bcf5ce3d9e94eb05398de20c00b280f8ca2..0a6fc6b3f284f844955795d018b55e3097dc7530 100644 (file)
@@ -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]] = !{}