[llvm] r297973 - Fix unused variable warnings.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 09:43:43 PDT 2017


Probably not a significant one - dyn_cast has to do a little more work to
probably support handling object offsets, etc. But mostly I'd choose the
isa for readability - if the static pointer type isn't needed, don't use
it, etc.

On Mon, Mar 20, 2017 at 9:36 AM Adrian Prantl <aprantl at apple.com> wrote:

> It's not overloaded, so it isn't necessary. Is there a performance
> difference or some other reason to prefer the isa over the dyn_cast?
>
> -- adrian
>
> On Mar 20, 2017, at 9:33 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
> Should these be isa instead of dyn_cast, if the result of the cast isn't
> really needed? (or is findDbgValues overloaded to benefit from the more
> constrained static types being passed after this change?)
>
> On Thu, Mar 16, 2017 at 11:45 AM Adrian Prantl via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> Author: adrian
> Date: Thu Mar 16 13:33:01 2017
> New Revision: 297973
>
> URL: http://llvm.org/viewvc/llvm-project?rev=297973&view=rev
> Log:
> Fix unused variable warnings.
>
> Modified:
>     llvm/trunk/lib/Transforms/Utils/Local.cpp
>
> Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=297973&r1=297972&r2=297973&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/Local.cpp Thu Mar 16 13:33:01 2017
> @@ -1358,14 +1358,14 @@ void llvm::salvageDebugInfo(Instruction
>    };
>    auto &M = *I.getModule();
>    if (auto *BitCast = dyn_cast<BitCastInst>(&I))
> -    findDbgValues(&I, [&](DbgValueInst &DVI) {
> +    findDbgValues(BitCast, [&](DbgValueInst &DVI) {
>        // Bitcasts are entirely irrelevant for debug info. Rewrite the
> dbg.value
>        // to use the cast's source.
>        DVI.setOperand(0, MDWrap(I.getOperand(0)));
>        DEBUG(dbgs() << "SALVAGE: " << DVI << '\n');
>      });
>    else if (auto *GEP = dyn_cast<GetElementPtrInst>(&I))
> -    findDbgValues(&I, [&](DbgValueInst &DVI) {
> +    findDbgValues(GEP, [&](DbgValueInst &DVI) {
>        unsigned BitWidth =
>
>  M.getDataLayout().getPointerSizeInBits(GEP->getPointerAddressSpace());
>        APInt Offset(BitWidth, 0);
> @@ -1381,7 +1381,7 @@ void llvm::salvageDebugInfo(Instruction
>        }
>      });
>    else if (auto *Load = dyn_cast<LoadInst>(&I))
> -    findDbgValues(&I, [&](DbgValueInst &DVI) {
> +    findDbgValues(Load, [&](DbgValueInst &DVI) {
>        // Rewrite the load into DW_OP_deref.
>        auto *DIExpr = DVI.getExpression();
>        DIBuilder DIB(M, /*AllowUnresolved*/ false);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170320/d17bdc5f/attachment.html>


More information about the llvm-commits mailing list