> URL: http://llvm.org/viewvc/llvm-project?rev=40919&view=rev
> Log:
> First round of cleanups from Chris'  feedback.

Cool.  in addition to saying why you did it, plz say "what" you did  
for the svn log. :)

> +
> +    // Find the base pointer that a pointer came from
> +    // Because this is used to find pointers that originate
> +    // from allocas, it is safe to ignore GEP indices, since
> +    // either the store will be in the alloca, and thus dead,
> +    // or beyond the end of the alloca, and thus undefined.

Please use /// comments so they are included in doxygen.

> +    Value* pointer = 0;
> +    if (StoreInst* S = dyn_cast<StoreInst>(BBI))
> +      pointer = S->getPointerOperand();
> +    else if (FreeInst* F = dyn_cast<FreeInst>(BBI))
> +      pointer = F->getPointerOperand();
>
> +    assert(pointer && "Not a free or a store?");

I'd suggest just writing this as:

> +    if (StoreInst* S = dyn_cast<StoreInst>(BBI))
> +      pointer = S->getPointerOperand();
> +    else
> +      pointer = cast<FreeInst>(BBI)->getPointerOperand();

which makes it obvious that the assert is unneeded.

Thanks!

-Chris


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to