[llvm-commits] [llvm] r40711 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp test/Analysis/BasicAA/2007-08-01-NoAliasAndCalls.ll test/Analysis/BasicAA/2007-08-01-NoAliasAndGEP.ll

Chris Lattner clattner at apple.com
Thu Aug 2 11:00:16 CDT 2007


On Aug 1, 2007, at 6:18 PM, Christopher Lamb wrote:
> Author: clamb
> Teach BasicAA about noalias parameter attributes, but do it  
> correctly this time.

Nice!  One minor style nit-pick:

>        if (isa<Argument>(O1)) {
>          // Incoming argument cannot alias locally allocated object!
>          if (isa<AllocationInst>(O2)) return NoAlias;
> +
> +        // If they are two different objects, and one is a noalias  
> argument
> +        // then they do not alias.
> +        if (O1 != O2 && isNoAliasArgument(cast<Argument>(O1)))
> +          return NoAlias;

Instead of using isa + cast, please use dyncast:

        if (const Argument *O1Arg = dyn_cast<Argument>(O1)) {
          // Incoming argument cannot alias locally allocated object!
          if (isa<AllocationInst>(O2)) return NoAlias;
+
+        // If they are two different objects, and one is a noalias  
argument
+        // then they do not alias.
+        if (O1 != O2 && isNoAliasArgument(O1Arg))
+          return NoAlias;

Thanks Christopher,

-Chris



More information about the llvm-commits mailing list