[PATCH] D16073: [SelectionDAG] Use LLVM_ENABLE_ABI_BREAKING_CHECKS to save space

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 12:37:23 PST 2016


> On 2016-Jan-11, at 11:04, Davide Italiano <dccitaliano at gmail.com> wrote:
> 
> davide created this revision.
> davide added reviewers: resistor, dexonsmith.
> davide added a subscriber: llvm-commits.
> 
> As recommended by Duncan's post commit review on r251209.
> 
> http://reviews.llvm.org/D16073
> 
> Files:
>  include/llvm/CodeGen/SelectionDAG.h
>  include/llvm/CodeGen/SelectionDAGNodes.h
> 
> Index: include/llvm/CodeGen/SelectionDAGNodes.h
> ===================================================================
> --- include/llvm/CodeGen/SelectionDAGNodes.h
> +++ include/llvm/CodeGen/SelectionDAGNodes.h
> @@ -426,9 +426,11 @@
>   friend struct ilist_traits<SDNode>;
> 
> public:
> +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
>   /// Unique and persistent id per SDNode in the DAG.
>   /// Used for debug printing.
>   uint16_t PersistentId;
> +#endif
> 
>   //===--------------------------------------------------------------------===//
>   //  Accessors
> Index: include/llvm/CodeGen/SelectionDAG.h
> ===================================================================
> --- include/llvm/CodeGen/SelectionDAG.h
> +++ include/llvm/CodeGen/SelectionDAG.h
> @@ -215,7 +215,9 @@
>   /// Tracks dbg_value information through SDISel.
>   SDDbgInfo *DbgInfo;
> 
> +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
>   uint16_t NextPersistentId = 0;
> +#endif
> 
> public:
>   /// Clients of various APIs that cause global effects on
> 
> 
> <D16073.44527.patch>

> Index: include/llvm/CodeGen/SelectionDAGNodes.h
> ===================================================================
> --- include/llvm/CodeGen/SelectionDAGNodes.h
> +++ include/llvm/CodeGen/SelectionDAGNodes.h
> @@ -426,9 +426,11 @@
>    friend struct ilist_traits<SDNode>;
>  
>  public:
> +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS

This seems backward to me.  You need `PersistentId` iff the checks
are on.

>    /// Unique and persistent id per SDNode in the DAG.
>    /// Used for debug printing.
>    uint16_t PersistentId;
> +#endif
>  
>    //===--------------------------------------------------------------------===//
>    //  Accessors
> Index: include/llvm/CodeGen/SelectionDAG.h
> ===================================================================
> --- include/llvm/CodeGen/SelectionDAG.h
> +++ include/llvm/CodeGen/SelectionDAG.h
> @@ -215,7 +215,9 @@
>    /// Tracks dbg_value information through SDISel.
>    SDDbgInfo *DbgInfo;
>  
> +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS

Also seems backward.  I'd expect #ifdef.

>    uint16_t NextPersistentId = 0;
> +#endif
>  
>  public:
>    /// Clients of various APIs that cause global effects on
> 

I think you also need to guard the assertion(s), something like:
--
#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS
assert(isCorrect(PersistentId) && "whatever the check is");
#endif
--



More information about the llvm-commits mailing list