From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25039 invoked by alias); 20 Apr 2004 14:15:21 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 25021 invoked by uid 48); 20 Apr 2004 14:15:14 -0000 Date: Tue, 20 Apr 2004 14:44:00 -0000 Message-ID: <20040420141514.25020.qmail@sources.redhat.com> From: "dann at godzilla dot ics dot uci dot edu" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040420010538.15017.pinskia@gcc.gnu.org> References: <20040420010538.15017.pinskia@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug optimization/15017] [tree-ssa] compare (equal) with casts are not removed X-Bugzilla-Reason: CC X-SW-Source: 2004-04/txt/msg01700.txt.bz2 List-Id: ------- Additional Comments From dann at godzilla dot ics dot uci dot edu 2004-04-20 14:15 ------- It seems that the underlying problem is casting bools to int before using them. For example look at the .original dump: ;; Function foo0 (foo0) ;; enabled by -tree-original { if ((int)a != 0) return = 1; else return = 0; } The cast does not seem to be needed, != can take a bool as an argument. Not emitting casts there will simplify the work the optimizers have to do. I only gave you one function, here is the file I was playing with: _Bool foo (_Bool a, _Bool b) { if (a != b) return 1; else return 0; } _Bool foo0 (_Bool a) { if (a) return 1; else return 0; } _Bool bar (_Bool a) { return a; } _Bool foo1 (_Bool a, _Bool b) { if (bar(a)) return 1; else return 0; } struct mm { _Bool a; _Bool b; } T; _Bool foo2 (void) { if (T.a != T.b) return 1; else return 0; } static _Bool as, bs; _Bool foo3 (void) { if (as != bs) return 1; else return 0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15017