This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Right now we don't optimize if a bool variable is compared not equal to zero or equal to one. This implements that folding of those two and treats BOOLEAN_TYPE like INTEGER_TYPE in fold_widened_comparison so we get the folding of "(int)bool_var != 0" into "bool_var != 0".
Thanks, Andrew Pinski
* fold-const.c (fold_widened_comparison): Treat BOOLEAN_TYPE the same as INTEGER_TYPE. (fold_binary): Fold "bool_var != 0" to bool_var. Fold "bool_var == 1" to bool_var.
Attachment:
temp.diff.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |