[llvm] r223142 - Appease a build bot complaining about an unused variable that's used in an assertion.

Aaron Ballman aaron at aaronballman.com
Tue Dec 2 11:45:47 PST 2014


On Tue, Dec 2, 2014 at 2:44 PM, Philip Reames <listmail at philipreames.com> wrote:
>
> On 12/02/2014 11:38 AM, Aaron Ballman wrote:
>>
>> On Tue, Dec 2, 2014 at 2:28 PM, Philip Reames <listmail at philipreames.com>
>> wrote:
>>>
>>> Author: reames
>>> Date: Tue Dec  2 13:28:57 2014
>>> New Revision: 223142
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=223142&view=rev
>>> Log:
>>> Appease a build bot complaining about an unused variable that's used in
>>> an assertion.
>>>
>>>
>>> Modified:
>>>      llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
>>>
>>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp?rev=223142&r1=223141&r2=223142&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp (original)
>>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp Tue Dec  2
>>> 13:28:57 2014
>>> @@ -230,6 +230,7 @@ static SDNode *lowerCallFromStatepoint(c
>>>
>>>     int NumCallArgs =
>>> dyn_cast<ConstantInt>(CI.getArgOperand(1))->getZExtValue();
>>>     assert(NumCallArgs >= 0 && "non-negative");
>>> +  (void)NumCallArgs;
>>
>> I think it's preferable to remove the variable entirely, and instead
>> write:
>>
>> assert(dyn_cast<ConstantInt>(CI.getArgOperand(1))->getZExtValue() >= 0
>> && "non-negative");
>>
>> This negates the ugly workaround, and also reduces overhead in builds
>> without asserts.
>
> I disagree.  Doing this would lose the documentation provided by the name
> for no real gain.

That is why the assert has the && string literal. It's also what
comments are for. ;-)

~Aaron

> Now, having said that, I made a note to come back and examine why this
> assert is here.  I think this should probably live in the Verifier instead.
> I'll likely move it later today.
>
>>
>> ~Aaron
>>>
>>>     ImmutableStatepoint StatepointOperands(&CI);
>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>



More information about the llvm-commits mailing list