[cfe-commits] r153447 - in /cfe/trunk: lib/CodeGen/CGClass.cpp lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h lib/CodeGen/CodeGenTBAA.cpp lib/CodeGen/CodeGenTBAA.h test/CodeGen/tbaa-for-vptr.cpp

Chandler Carruth chandlerc at google.com
Mon Mar 26 13:24:13 PDT 2012


Yea, it's failing for us too...

On Mon, Mar 26, 2012 at 1:16 PM, Bill Wendling <wendling at apple.com> wrote:

> Hi Kostya,
>
> This is failing on our buildbots. Could you investigate, please?
>
> (view as text)
> ******************** TEST 'Clang :: CodeGen/tbaa-for-vptr.cpp' FAILED
> ********************Script:
> --
> /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang-build/Release/bin/clang
> -cc1 -internal-isystem
> /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang-build/Release/bin/../lib/clang/3.1/include
> -emit-llvm -o - -O1
> /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang.src/test/CodeGen/tbaa-for-vptr.cpp
> | FileCheck
> /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang.src/test/CodeGen/tbaa-for-vptr.cpp
> --
> Exit Code: 1
> Command Output (stderr):
> --
> /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang.src/test/CodeGen/tbaa-for-vptr.cpp:16:11:
> error: expected string not found in input
> // CHECK: %vtable = load {{.*}} !tbaa !0
>           ^
> <stdin>:1:1: note: scanning from here
> ; ModuleID =
> '/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang.src/test/CodeGen/tbaa-for-vptr.cpp'
> ^
> <stdin>:28:32: note: possible intended match here
>  %2 = load i32 (%struct.A*)*** %1, align 8, !tbaa !0
>                               ^
> --
>
> ********************
>
>
> -bw
>
> On Mar 26, 2012, at 10:03 AM, Kostya Serebryany <kcc at google.com> wrote:
>
> > Author: kcc
> > Date: Mon Mar 26 12:03:51 2012
> > New Revision: 153447
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=153447&view=rev
> > Log:
> > add tbaa metadata to vtable pointer loads/stores
> >
> > Added:
> >    cfe/trunk/test/CodeGen/tbaa-for-vptr.cpp
> > Modified:
> >    cfe/trunk/lib/CodeGen/CGClass.cpp
> >    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> >    cfe/trunk/lib/CodeGen/CodeGenModule.h
> >    cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp
> >    cfe/trunk/lib/CodeGen/CodeGenTBAA.h
> >
> > Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=153447&r1=153446&r2=153447&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CGClass.cpp Mon Mar 26 12:03:51 2012
> > @@ -1514,7 +1514,8 @@
> >   llvm::Type *AddressPointPtrTy =
> >     VTableAddressPoint->getType()->getPointerTo();
> >   VTableField = Builder.CreateBitCast(VTableField, AddressPointPtrTy);
> > -  Builder.CreateStore(VTableAddressPoint, VTableField);
> > +  llvm::StoreInst *Store = Builder.CreateStore(VTableAddressPoint,
> VTableField);
> > +  CGM.DecorateInstruction(Store, CGM.getTBAAInfoForVTablePtr());
> > }
> >
> > void
> > @@ -1597,7 +1598,9 @@
> > llvm::Value *CodeGenFunction::GetVTablePtr(llvm::Value *This,
> >                                            llvm::Type *Ty) {
> >   llvm::Value *VTablePtrSrc = Builder.CreateBitCast(This,
> Ty->getPointerTo());
> > -  return Builder.CreateLoad(VTablePtrSrc, "vtable");
> > +  llvm::Instruction *VTable = Builder.CreateLoad(VTablePtrSrc,
> "vtable");
> > +  CGM.DecorateInstruction(VTable, CGM.getTBAAInfoForVTablePtr());
> > +  return VTable;
> > }
> >
> > static const CXXRecordDecl *getMostDerivedClassDecl(const Expr *Base) {
> >
> > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=153447&r1=153446&r2=153447&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Mar 26 12:03:51 2012
> > @@ -182,6 +182,12 @@
> >   return TBAA->getTBAAInfo(QTy);
> > }
> >
> > +llvm::MDNode *CodeGenModule::getTBAAInfoForVTablePtr() {
> > +  if (!TBAA)
> > +    return 0;
> > +  return TBAA->getTBAAInfoForVTablePtr();
> > +}
> > +
> > void CodeGenModule::DecorateInstruction(llvm::Instruction *Inst,
> >                                         llvm::MDNode *TBAAInfo) {
> >   Inst->setMetadata(llvm::LLVMContext::MD_tbaa, TBAAInfo);
> >
> > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=153447&r1=153446&r2=153447&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
> > +++ cfe/trunk/lib/CodeGen/CodeGenModule.h Mon Mar 26 12:03:51 2012
> > @@ -448,6 +448,7 @@
> >   bool shouldUseTBAA() const { return TBAA != 0; }
> >
> >   llvm::MDNode *getTBAAInfo(QualType QTy);
> > +  llvm::MDNode *getTBAAInfoForVTablePtr();
> >
> >   bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor);
> >
> >
> > Modified: cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp?rev=153447&r1=153446&r2=153447&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp Mon Mar 26 12:03:51 2012
> > @@ -179,3 +179,7 @@
> >   // For now, handle any other kind of type conservatively.
> >   return MetadataCache[Ty] = getChar();
> > }
> > +
> > +llvm::MDNode *CodeGenTBAA::getTBAAInfoForVTablePtr() {
> > +  return getTBAAInfoForNamedType("vtable pointer", getRoot());
> > +}
> >
> > Modified: cfe/trunk/lib/CodeGen/CodeGenTBAA.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTBAA.h?rev=153447&r1=153446&r2=153447&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/CodeGen/CodeGenTBAA.h (original)
> > +++ cfe/trunk/lib/CodeGen/CodeGenTBAA.h Mon Mar 26 12:03:51 2012
> > @@ -68,6 +68,10 @@
> >   /// getTBAAInfo - Get the TBAA MDNode to be used for a dereference
> >   /// of the given type.
> >   llvm::MDNode *getTBAAInfo(QualType QTy);
> > +
> > +  /// getTBAAInfoForVTablePtr - Get the TBAA MDNode to be used for a
> > +  /// dereference of a vtable pointer.
> > +  llvm::MDNode *getTBAAInfoForVTablePtr();
> > };
> >
> > }  // end namespace CodeGen
> >
> > Added: cfe/trunk/test/CodeGen/tbaa-for-vptr.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/tbaa-for-vptr.cpp?rev=153447&view=auto
> >
> ==============================================================================
> > --- cfe/trunk/test/CodeGen/tbaa-for-vptr.cpp (added)
> > +++ cfe/trunk/test/CodeGen/tbaa-for-vptr.cpp Mon Mar 26 12:03:51 2012
> > @@ -0,0 +1,19 @@
> > +// RUN: %clang_cc1 -emit-llvm -o - -O1 %s | FileCheck %s
> > +// Check that we generate TBAA for vtable pointer loads and stores.
> > +struct A {
> > +  virtual int foo() const ;
> > +  virtual ~A();
> > +};
> > +
> > +void CreateA() {
> > +  new A;
> > +}
> > +
> > +void CallFoo(A *a) {
> > +  a->foo();
> > +}
> > +
> > +// CHECK: %vtable = load {{.*}} !tbaa !0
> > +// CHECK: store {{.*}} !tbaa !0
> > +// CHECK: !0 = metadata !{metadata !"vtable pointer", metadata !1}
> > +// CHECK: !1 = metadata !{metadata !"Simple C/C++ TBAA", null}
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120326/03208f29/attachment.html>


More information about the cfe-commits mailing list