On Wed, Sep 30, 2015 at 8:52 PM Piotr Padlewski via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: prazek
> Date: Wed Sep 30 22:50:41 2015
> New Revision: 248982
>
> URL: http://llvm.org/viewvc/llvm-project?rev=248982&view=rev
> Log:
> Decorating virtual functions load with invariant.load
>

This change description really doesn't tell me anything about what this
change does. Could you try to write more detailed and explanatory change
logs?

Imagine a reader that has little or no context reading the change log to
gain the context necessary to read the actual patch and understand what is
going on with it.


>
> http://reviews.llvm.org/D13279
>
> Modified:
>     cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
>     cfe/trunk/test/CodeGenCXX/virtual-function-calls.cpp
>
> Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=248982&r1=248981&r2=248982&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
> +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Wed Sep 30 22:50:41 2015
> @@ -1609,7 +1609,16 @@ llvm::Value *ItaniumCXXABI::getVirtualFu
>    uint64_t VTableIndex =
> CGM.getItaniumVTableContext().getMethodVTableIndex(GD);
>    llvm::Value *VFuncPtr =
>        CGF.Builder.CreateConstInBoundsGEP1_64(VTable, VTableIndex, "vfn");
> -  return CGF.Builder.CreateAlignedLoad(VFuncPtr, CGF.getPointerAlign());
> +  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;
>  }
>
>  llvm::Value *ItaniumCXXABI::EmitVirtualDestructorCall(
>
> Modified: cfe/trunk/test/CodeGenCXX/virtual-function-calls.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/virtual-function-calls.cpp?rev=248982&r1=248981&r2=248982&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/virtual-function-calls.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/virtual-function-calls.cpp Wed Sep 30
> 22:50:41 2015
> @@ -1,4 +1,5 @@
>  // 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 {
> @@ -42,10 +43,14 @@ namespace VirtualNoreturn {
>      [[noreturn]] virtual void f();
>    };
>
> -  // CHECK: @_ZN15VirtualNoreturn1f
> +  // CHECK-LABEL: @_ZN15VirtualNoreturn1f
> +  // CHECK-INVARIANT-LABEL: define void @_ZN15VirtualNoreturn1f
>    void f(A *p) {
>      p->f();
>      // CHECK: call {{.*}}void %{{[^#]*$}}
>      // CHECK-NOT: unreachable
> +    // CHECK-INVARIANT: load {{.*}} align 8, !invariant.load
> ![[EMPTY_NODE:[0-9]]]
>    }
>  }
> +
> +// CHECK-INVARIANT: ![[EMPTY_NODE]] = !{}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to