[llvm] r225133 - Fix unused variable warning for non-asserts builds. NFC.

David Blaikie dblaikie at gmail.com
Sun Jan 4 08:59:47 PST 2015


On Sun, Jan 4, 2015 at 5:35 AM, Michael Kuperstein <
michael.m.kuperstein at intel.com> wrote:

> Author: mkuper
> Date: Sun Jan  4 07:35:44 2015
> New Revision: 225133
>
> URL: http://llvm.org/viewvc/llvm-project?rev=225133&view=rev
> Log:
> Fix unused variable warning for non-asserts builds. NFC.
>
> Modified:
>     llvm/trunk/lib/Analysis/ValueTracking.cpp
>
> Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=225133&r1=225132&r2=225133&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
> +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Sun Jan  4 07:35:44 2015
> @@ -485,12 +485,12 @@ static void computeKnownBitsFromAssume(V
>
>    unsigned BitWidth = KnownZero.getBitWidth();
>
> -  Function *F = const_cast<Function*>(Q.CxtI->getParent()->getParent());
>    for (auto &AssumeVH : Q.AC->assumptions()) {
>      if (!AssumeVH)
>        continue;
>      CallInst *I = cast<CallInst>(AssumeVH);
> -    assert(I->getParent()->getParent() == F &&
> +    assert((I->getParent()->getParent() ==
> +            const_cast<Function*>(Q.CxtI->getParent()->getParent()))


Is that const_cast necessary? You should be able to compare const T* and T*
just fine without casting away constness...


> &&
>             "Got assumption for the wrong function!");
>      if (Q.ExclInvs.count(I))
>        continue;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150104/6df7e64e/attachment.html>


More information about the llvm-commits mailing list