Jeff, Sorry for bringing back this thread.
Quick question, you mentioned checking the TYPE_PRECISION to make sure the type is a canonical Boolean type (and not a fancy signed/unsigned Boolean type from Ada Andrew mentioned). But I noticed that truth_valued_p does already check for: (if (INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) == 1)) So in this case, there should not any other Boolean type fall into truth_valued_p type [1]? Is that right? 1) https://github.com/gcc-mirror/gcc/blob/master/gcc/match.pd#L1717 Best wishes, Navid. ________________________________________ From: Jeff Law <jeffreya...@gmail.com> Sent: Tuesday, November 23, 2021 12:03 To: Navid Rahimi; Andrew Pinski Cc: Navid Rahimi via Gcc-patches Subject: Re: [EXTERNAL] Re: [PATCH][WIP] PR tree-optimization/101808 Boolean comparison simplification On 11/23/2021 12:55 PM, Navid Rahimi wrote: >> Did you test Ada with this patch as that is where the "odd" boolean >> types show up? > No I haven't tested Ada yet. Since it is work in progress still [WIP]. Quick > question, to prevent applying this optimization to those odd Boolean types in > Ada, there should be a check to check whether it is canonical boolean type or > signed/unsigned, which should prevent messing with odd Boolean types in Ada. IIRC, you should check the type's precision. THere should be examples you can find in one or more of the gimple optimizers. jeff