[PATCH] D17157: Add the beginnings of an update API for preserving MemorySSA

Mikael Holmén via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 2 02:44:31 PST 2016


Hi,

There seems to be a problem in the MemorySSA.cpp test case:

First a Function is built

   std::unique_ptr<Function> F(Function::Create(
       FunctionType::get(B.getVoidTy(), {B.getInt8PtrTy()}, false),
       GlobalValue::ExternalLinkage, "F"));

Note that we don't pass any Module to the Function:

   static Function *Create(FunctionType *Ty, LinkageTypes Linkage,
                           const Twine &N = "", Module *M = nullptr)

o the Function's Module will be nullptr.

However, throughout the code there are places where it is assumed that 
the Module can be fetched, e.g. in

MemoryLocation MemoryLocation::get(const LoadInst *LI) {
   AAMDNodes AATags;
   LI->getAAMetadata(AATags);
   const auto &DL = LI->getModule()->getDataLayout();

   return MemoryLocation(LI->getPointerOperand(),
                         DL.getTypeStoreSize(LI->getType()), AATags);
}

which in the MemorySSA test indeed gets called:

#3  0x00000000006b3886 in llvm::MemoryLocation::get (Inst=0xda03f8) at 
include/llvm/Analysis/MemoryLocation.h:72
#4  0x00000000006b2c84 in 
llvm::CachingMemorySSAWalker::getClobberingMemoryAccess (this=0xda1bf0, 
I=0xda03f8)
     at lib/Transforms/Utils/MemorySSA.cpp:1047
#5  0x00000000006aff7a in llvm::MemorySSA::buildMemorySSA 
(this=0xda0440, AA=0xda16c0, DT=0xda04c0)
     at lib/Transforms/Utils/MemorySSA.cpp:346
#6  0x000000000042786f in MemorySSA_RemoveMemoryAccess_Test::TestBody 
(this=0xd9a920) at unittests/Transforms/Utils/MemorySSA.cpp:55

So I suppose a Module should be created as well to setup the test properly.

Regards,
Mikael


On 03/01/2016 07:51 PM, Phabricator via llvm-commits wrote:
> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL262362: Add the beginnings of an update API for preserving MemorySSA (authored by dannyb).
>
> Changed prior to commit:
>    http://reviews.llvm.org/D17157?vs=47855&id=49511#toc
>
> Repository:
>    rL LLVM
>
> http://reviews.llvm.org/D17157
>
> Files:
>    llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
>    llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
>    llvm/trunk/unittests/Transforms/Utils/CMakeLists.txt
>    llvm/trunk/unittests/Transforms/Utils/MemorySSA.cpp
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>


More information about the llvm-commits mailing list