[llvm] fabe52a - Fix uninitialized variable warning. NFC.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 11:40:13 PDT 2020


Fixed this in 5aead592f09db941d6fc9c075e474c59b7d1d4f9

On Thu, Mar 26, 2020 at 12:46 PM David Blaikie <dblaikie at gmail.com> wrote:

> Which compiler warned about this? It looks like this would be a bad
> compiler warning we maybe shuold disable, because the variable is
> initialized before being used in the code that follows & it's best not to
> add an unneeded initialization like that - since it thwarts the warning (or
> msan, etc) from catching real bugs that might be introduced later (if
> another arg mode was added & wasn't fully handled in the code that came
> after)
>
> The other thing might be worth doing is changing those unreachables to
> assertions...
>
> assert(ArgVT != MVT::f80 && "Not yet implemented");
> if (is floating point && size <= 16)
>   Mode = 2;
> else
>   assert(is integer && size <= 32)
>   Mode = 1
>
> That might be easier for a compiler to see that it's always initialized
> before use.
>
> On Thu, Feb 27, 2020 at 6:29 AM Simon Pilgrim via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>>
>> Author: Simon Pilgrim
>> Date: 2020-02-27T14:20:43Z
>> New Revision: fabe52a7412d850bf06e006db1d53de0500a1853
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/fabe52a7412d850bf06e006db1d53de0500a1853
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/fabe52a7412d850bf06e006db1d53de0500a1853.diff
>>
>> LOG: Fix uninitialized variable warning. NFC.
>>
>> Added:
>>
>>
>> Modified:
>>     llvm/lib/Target/X86/X86ISelLowering.cpp
>>
>> Removed:
>>
>>
>>
>>
>> ################################################################################
>> diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp
>> b/llvm/lib/Target/X86/X86ISelLowering.cpp
>> index 1cc9c7b16d78..c2d18e21d07d 100644
>> --- a/llvm/lib/Target/X86/X86ISelLowering.cpp
>> +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
>> @@ -23423,7 +23423,7 @@ SDValue X86TargetLowering::LowerVAARG(SDValue Op,
>> SelectionDAG &DAG) const {
>>    EVT ArgVT = Op.getNode()->getValueType(0);
>>    Type *ArgTy = ArgVT.getTypeForEVT(*DAG.getContext());
>>    uint32_t ArgSize = DAG.getDataLayout().getTypeAllocSize(ArgTy);
>> -  uint8_t ArgMode;
>> +  uint8_t ArgMode = 0;
>>
>>    // Decide which area this value should be read from.
>>    // TODO: Implement the AMD64 ABI in its entirety. This simple
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> https://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/20200421/75eeead4/attachment.html>


More information about the llvm-commits mailing list