[llvm] r254362 - Squelch unused variable warning in SIRegisterInfo.cpp.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 14:23:30 PST 2015


I didn't write it this way initially because it seemed like the "ST"
variable was part of a larger convention, but I'm totally fine making
this change if desired.  (Indeed I'm usually the one asking people to
inline their one-use temporaries.  :)

On Thu, Dec 3, 2015 at 12:36 PM, Justin Bogner <mail at justinbogner.com> wrote:
> Matt Arsenault via llvm-commits <llvm-commits at lists.llvm.org> writes:
>> Author: arsenm
>> Date: Mon Nov 30 20:14:33 2015
>> New Revision: 254362
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=254362&view=rev
>> Log:
>> Squelch unused variable warning in SIRegisterInfo.cpp.
>>
>> Patch by Justin Lebar
>>
>> Modified:
>>     llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp
>>
>> Modified: llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp?rev=254362&r1=254361&r2=254362&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp (original)
>> +++ llvm/trunk/lib/Target/AMDGPU/SIRegisterInfo.cpp Mon Nov 30 20:14:33 2015
>> @@ -566,8 +566,9 @@ bool SIRegisterInfo::opCanUseInlineConst
>>  unsigned SIRegisterInfo::getPreloadedValue(const MachineFunction &MF,
>>                                             enum PreloadedValue Value) const {
>>
>> -  const AMDGPUSubtarget &ST = MF.getSubtarget<AMDGPUSubtarget>();
>>    const SIMachineFunctionInfo *MFI = MF.getInfo<SIMachineFunctionInfo>();
>> +  const AMDGPUSubtarget &ST = MF.getSubtarget<AMDGPUSubtarget>();
>> +  (void)ST;
>
> This is pretty far from the use and the variable is only used once.
> Wouldn't it be better to just roll getSubtarget into the call to assert?
>
>>    switch (Value) {
>>    case SIRegisterInfo::WORKGROUP_ID_X:
>>      assert(MFI->hasWorkGroupIDX());
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list