[llvm-commits] [llvm] r171303 - in /llvm/trunk: include/llvm/Analysis/MemoryBuiltins.h lib/Analysis/MemoryBuiltins.cpp

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Dec 31 08:30:36 PST 2012


testcase?

On 31 December 2012 11:23, Nuno Lopes <nunoplopes at sapo.pt> wrote:
> Author: nlopes
> Date: Mon Dec 31 10:23:48 2012
> New Revision: 171303
>
> URL: http://llvm.org/viewvc/llvm-project?rev=171303&view=rev
> Log:
> add support for GlobalAlias to ObjectSizeOffsetVisitor
>
> Modified:
>     llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h
>     llvm/trunk/lib/Analysis/MemoryBuiltins.cpp
>
> Modified: llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h?rev=171303&r1=171302&r2=171303&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h (original)
> +++ llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h Mon Dec 31 10:23:48 2012
> @@ -191,6 +191,7 @@
>    SizeOffsetType visitExtractElementInst(ExtractElementInst &I);
>    SizeOffsetType visitExtractValueInst(ExtractValueInst &I);
>    SizeOffsetType visitGEPOperator(GEPOperator &GEP);
> +  SizeOffsetType visitGlobalAlias(GlobalAlias &GA);
>    SizeOffsetType visitGlobalVariable(GlobalVariable &GV);
>    SizeOffsetType visitIntToPtrInst(IntToPtrInst&);
>    SizeOffsetType visitLoadInst(LoadInst &I);
>
> Modified: llvm/trunk/lib/Analysis/MemoryBuiltins.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryBuiltins.cpp?rev=171303&r1=171302&r2=171303&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/MemoryBuiltins.cpp (original)
> +++ llvm/trunk/lib/Analysis/MemoryBuiltins.cpp Mon Dec 31 10:23:48 2012
> @@ -399,6 +399,8 @@
>      return visitArgument(*A);
>    if (ConstantPointerNull *P = dyn_cast<ConstantPointerNull>(V))
>      return visitConstantPointerNull(*P);
> +  if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V))
> +    return visitGlobalAlias(*GA);
>    if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
>      return visitGlobalVariable(*GV);
>    if (UndefValue *UV = dyn_cast<UndefValue>(V))
> @@ -517,6 +519,12 @@
>    return std::make_pair(PtrData.first, PtrData.second + Offset);
>  }
>
> +SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalAlias(GlobalAlias &GA) {
> +  if (GA.mayBeOverridden())
> +    return unknown();
> +  return compute(GA.getAliasee());
> +}
> +
>  SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalVariable(GlobalVariable &GV){
>    if (!GV.hasDefinitiveInitializer())
>      return unknown();
> @@ -629,6 +637,7 @@
>    } else if (isa<Argument>(V) ||
>               (isa<ConstantExpr>(V) &&
>                cast<ConstantExpr>(V)->getOpcode() == Instruction::IntToPtr) ||
> +             isa<GlobalAlias>(V) ||
>               isa<GlobalVariable>(V)) {
>      // ignore values where we cannot do more than what ObjectSizeVisitor can
>      Result = unknown();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list