<div dir="ltr">Hi David,<div><br></div><div>I was doing that in the past, until someone else sent a message saying that the general convention in LLVM is to rather put a `(void)x;` statement. Unfortunately I can't find the mailing thread right now.</div><div>I would be more happy with inlining, as it *might* get rid of some redundant calculations in release builds. Do we have any written consensus around this one to direct people in the future for one way or another?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 9, 2020 at 4:46 AM David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If a variable is only used once in the assertion ,could you roll the<br>
initialization into the assert (folding the named variable away)?<br>
<br>
On Wed, Jun 3, 2020 at 2:49 AM Kadir Cetinkaya via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
><br>
> Author: Kadir Cetinkaya<br>
> Date: 2020-06-03T11:49:01+02:00<br>
> New Revision: c5468253aa555c2df98bd1f49d1e9d44b0150a2e<br>
><br>
> URL: <a href="https://github.com/llvm/llvm-project/commit/c5468253aa555c2df98bd1f49d1e9d44b0150a2e" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/c5468253aa555c2df98bd1f49d1e9d44b0150a2e</a><br>
> DIFF: <a href="https://github.com/llvm/llvm-project/commit/c5468253aa555c2df98bd1f49d1e9d44b0150a2e.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/c5468253aa555c2df98bd1f49d1e9d44b0150a2e.diff</a><br>
><br>
> LOG: [llvm] Fix unused variable warnings<br>
><br>
> Added:<br>
><br>
><br>
> Modified:<br>
>     llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
><br>
> Removed:<br>
><br>
><br>
><br>
> ################################################################################<br>
> diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
> index 67504f827d63..061330677680 100644<br>
> --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
> +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
> @@ -807,6 +807,7 @@ static void collectCallSiteParameters(const MachineInstr *CallMI,<br>
>      auto Suc = std::next(CallMI->getIterator());<br>
>      // Only one-instruction delay slot is supported.<br>
>      auto BundleEnd = llvm::getBundleEnd(CallMI->getIterator());<br>
> +    (void)BundleEnd;<br>
>      assert(std::next(Suc) == BundleEnd &&<br>
>             "More than one instruction in call delay slot");<br>
>      // Try to interpret value loaded by instruction.<br>
> @@ -856,7 +857,9 @@ void DwarfDebug::constructCallSiteEntryDIEs(const DISubprogram &SP,<br>
>        return false;<br>
>      auto Suc = std::next(MI.getIterator());<br>
>      auto CallInstrBundle = getBundleStart(MI.getIterator());<br>
> +    (void)CallInstrBundle;<br>
>      auto DelaySlotBundle = getBundleStart(Suc);<br>
> +    (void)DelaySlotBundle;<br>
>      // Ensure that label after call is following delay slot instruction.<br>
>      // Ex. CALL_INSTRUCTION {<br>
>      //       DELAY_SLOT_INSTRUCTION }<br>
> @@ -1893,6 +1896,7 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {<br>
>      if (!MI.isBundledWithSucc())<br>
>        return false;<br>
>      auto Suc = std::next(MI.getIterator());<br>
> +    (void)Suc;<br>
>      // Ensure that delay slot instruction is successor of the call instruction.<br>
>      // Ex. CALL_INSTRUCTION {<br>
>      //        DELAY_SLOT_INSTRUCTION }<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>