[llvm] 723fea2 - Silence 'warning: unused variable' when compiling with Clang 10.0

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 06:09:29 PDT 2020


Certainly, thanks for the suggestion! Please see: https://reviews.llvm.org/rG723fea23079f9c85800e5cdc90a75414af182bfd

Best,
Alex.

-----Message d'origine-----
De : David Blaikie <dblaikie at gmail.com> 
Envoyé : September 23, 2020 5:26 PM
À : Alexandre Ganea <alexandre.ganea at ubisoft.com>; Alexandre Ganea <llvmlistbot at llvm.org>
Cc : llvm-commits <llvm-commits at lists.llvm.org>
Objet : Re: [llvm] 723fea2 - Silence 'warning: unused variable' when compiling with Clang 10.0

Generally, if a variable is only used in one assertion right next to it - it'd be preferably to fold the expression into the assertion, rather than #ifndefing (makes future changes easier - the assertion can be removed without leaving dead code, etc)

On Tue, Sep 22, 2020 at 9:17 AM Alexandre Ganea via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Alexandre Ganea
> Date: 2020-09-22T12:17:40-04:00
> New Revision: 723fea23079f9c85800e5cdc90a75414af182bfd
>
> URL: 
> https://github.com/llvm/llvm-project/commit/723fea23079f9c85800e5cdc90
> a75414af182bfd
> DIFF: 
> https://github.com/llvm/llvm-project/commit/723fea23079f9c85800e5cdc90
> a75414af182bfd.diff
>
> LOG: Silence 'warning: unused variable' when compiling with Clang 10.0
>
> Added:
>
>
> Modified:
>     llvm/lib/CodeGen/PeepholeOptimizer.cpp
>
> Removed:
>
>
>
> ######################################################################
> ########## diff  --git a/llvm/lib/CodeGen/PeepholeOptimizer.cpp 
> b/llvm/lib/CodeGen/PeepholeOptimizer.cpp
> index ca9e3cd25caa..4f05468d976b 100644
> --- a/llvm/lib/CodeGen/PeepholeOptimizer.cpp
> +++ b/llvm/lib/CodeGen/PeepholeOptimizer.cpp
> @@ -1413,7 +1413,9 @@ bool PeepholeOptimizer::foldRedundantCopy(
>
>    MachineInstr *PrevCopy = CopyMIs.find(SrcPair)->second;
>
> +#ifndef NDEBUG
>    unsigned PrevSrcSubReg = PrevCopy->getOperand(1).getSubReg();
> +#endif
>    assert(SrcSubReg == PrevSrcSubReg && "Unexpected mismatching 
> subreg!");
>
>    Register PrevDstReg = PrevCopy->getOperand(0).getReg();
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list