[llvm] r307138 - [globalisel][tablegen] Fix an unused variable warning in release builds after r307133

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 04:37:45 PDT 2017



> On 10 Jul 2017, at 19:43, David Blaikie <dblaikie at gmail.com> wrote:
> 
> The usual way to deal with unused values (when they're only used in an assert) in LLVM is with a (void)X; statement near the assertion - so it's easier to track them together.

This particular instance is no longer present in the current trunk (the code moved to InstructionSelectorImpl.h when the tables were merged) but I'll change the one in r307168 and similar cases that are still in the code.

> Alternatively, is there a reason the assertion couldn't move up two lines, before the increments as needed? (or does the increment cause a mutation of OutMIs.size in some indirect way?)

There's no strong reason it couldn't be moved up. It's just a cosmetic decision to fully parse the arguments to the opcode before acting on the opcode.

> On Wed, Jul 5, 2017 at 8:37 AM Daniel Sanders via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> Author: dsanders
> Date: Wed Jul  5 03:16:48 2017
> New Revision: 307138
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=307138&view=rev <http://llvm.org/viewvc/llvm-project?rev=307138&view=rev>
> Log:
> [globalisel][tablegen] Fix an unused variable warning in release builds after r307133
> 
> 
> Modified:
>     llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelector.cpp
> 
> Modified: llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelector.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelector.cpp?rev=307138&r1=307137&r2=307138&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelector.cpp?rev=307138&r1=307137&r2=307138&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelector.cpp (original)
> +++ llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelector.cpp Wed Jul  5 03:16:48 2017
> @@ -59,7 +59,7 @@ void InstructionSelector::executeEmitTab
>        break;
>      }
>      case GIR_BuildMI: {
> -      int64_t InsnID = *Command++;
> +      int64_t InsnID LLVM_ATTRIBUTE_UNUSED = *Command++;
>        int64_t Opcode = *Command++;
>        assert((size_t)InsnID == OutMIs.size() &&
>               "Expected to store MIs in order");
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <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/20170711/75f84741/attachment.html>


More information about the llvm-commits mailing list