[llvm] r334731 - Avoid unused variable in non-assert builds.

Nirav Davé via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 12:12:33 PDT 2018


getSDValue does have side effects in that it does a normalizing update, but
the looped call to replaced values immediately preceding avoids making such
modifications. I left the call as getSDValue as a direct call rather than
inlining it to explicitly avoid the superficially inlined check as it
captures the non-zero assertion in one place and we're already in an
expensive check so the marginal performance cost seemed acceptable.

I have no objections to changing it though.

-Nirav



On Mon, Jun 18, 2018 at 2:53 PM, David Blaikie <dblaikie at gmail.com> wrote:

> Could the getSDValue call be rolled into the assert? (to avoid doing the
> work of that function call when assertions are enabled) Or does it have
> necessary side effects that must occur even in a nonasserts build?
> (functions name 'get' with side effects are a bit misleading, though not
> all that uncommon)
>
> On Thu, Jun 14, 2018 at 8:59 AM Nirav Dave via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: niravd
>> Date: Thu Jun 14 08:55:15 2018
>> New Revision: 334731
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=334731&view=rev
>> Log:
>> Avoid unused variable in non-assert builds.
>>
>> Modified:
>>     llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
>>
>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
>> CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=334731&
>> r1=334730&r2=334731&view=diff
>> ============================================================
>> ==================
>> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Thu Jun 14
>> 08:55:15 2018
>> @@ -105,6 +105,7 @@ void DAGTypeLegalizer::PerformExpensiveC
>>            I = ReplacedValues.find(NewValId);
>>          }
>>          SDValue NewVal = getSDValue(NewValId);
>> +        (void)NewVal;
>>          assert(NewVal.getNode()->getNodeId() != NewNode &&
>>                 "ReplacedValues maps to a new node!");
>>        }
>>
>>
>> _______________________________________________
>> 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/20180618/c3a65964/attachment.html>


More information about the llvm-commits mailing list