From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13283 invoked by alias); 7 Aug 2007 12:26:12 -0000 Received: (qmail 13205 invoked by uid 22791); 7 Aug 2007 12:26:09 -0000 X-Spam-Check-By: sourceware.org Received: from nz-out-0506.google.com (HELO nz-out-0506.google.com) (64.233.162.236) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 07 Aug 2007 12:25:59 +0000 Received: by nz-out-0506.google.com with SMTP id s1so599192nze for ; Tue, 07 Aug 2007 05:25:57 -0700 (PDT) Received: by 10.143.28.7 with SMTP id f7mr296346wfj.1186489556954; Tue, 07 Aug 2007 05:25:56 -0700 (PDT) Received: by 10.142.99.11 with HTTP; Tue, 7 Aug 2007 05:25:55 -0700 (PDT) Message-ID: Date: Tue, 07 Aug 2007 12:26:00 -0000 From: "Andrew Pinski" To: "Andrew_Pinski@playstation.sony.com" Subject: Re: [PATCH] Fix IV-opts so it no longer produces MEM[index:] Cc: "Zdenek Dvorak" , gcc-patches@gcc.gnu.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_112330_7268805.1186489556797" References: <20070801095236.GA13479@kam.mff.cuni.cz> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-08/txt/msg00423.txt.bz2 ------=_Part_112330_7268805.1186489556797 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1447 On 8/1/07, Andrew_Pinski@playstation.sony.com > No, this is why we are getting MEM[index:] as generic_type_for for pointer > types is unsigned_type_for and unsigned_type_for returns the same size > integer as the pointer which is not what we want here really. Maybe we > should return the pointer to void type instead? Here is a new patch with an additional comment on why not converting to type is necessary/correct. It also takes into account your comment about create_iv. OK? Bootstrapped and tested on i386-apple-darwin8.10 with no regressions. Thanks, Andrew Pinski * tree-ssa-loop-manip.c (create_iv): Call force_gimple_operand for the step with a NULL_TREE. * tree-ssa-loop-ivopts.c (find_bivs): Convert the step to sizetype if type is a pointer type. (add_candidate_1): Don't convert the base and step to the generic type if the orginal type is a pointer type. (add_iv_value_candidates): Use sizetype for the step if type is a pointer type. (cand_value_at): Likewise. * tree-ssa-address.c (add_to_parts): Use POINTER_PLUS_EXPR for pointer types. * tree-affine.c (tree_to_aff_combination ): Don't convert the tem affine to the type. (add_elt_to_tree): Use sizetype for the step if a pointer. Use POINTER_PLUS_EXPR for pointers. (aff_combination_to_tree): Use sizetype for the step if a pointer. ------=_Part_112330_7268805.1186489556797 Content-Type: text/plain; name=fixivopts.diff.txt; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_hu0qec Content-Disposition: attachment; filename="fixivopts.diff.txt" Content-length: 7796 SW5kZXg6IHRyZWUtc3NhLWxvb3AtbWFuaXAuYwo9PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09Ci0tLSB0cmVlLXNzYS1sb29wLW1hbmlwLmMJKHJldmlzaW9uIDEy NzI2NikKKysrIHRyZWUtc3NhLWxvb3AtbWFuaXAuYwkod29ya2luZyBjb3B5 KQpAQCAtMTA0LDcgKzEwNCw3IEBAIGNyZWF0ZV9pdiAodHJlZSBiYXNlLCB0 cmVlIHN0ZXAsIHRyZWUgdmEKICAgICB9CiAgIC8qIEdpbXBsaWZ5IHRoZSBz dGVwIGlmIG5lY2Vzc2FyeS4gIFdlIHB1dCB0aGUgY29tcHV0YXRpb25zIGlu IGZyb250IG9mIHRoZQogICAgICBsb29wIChpLmUuIHRoZSBzdGVwIHNob3Vs ZCBiZSBsb29wIGludmFyaWFudCkuICAqLwotICBzdGVwID0gZm9yY2VfZ2lt cGxlX29wZXJhbmQgKHN0ZXAsICZzdG10cywgdHJ1ZSwgdmFyKTsKKyAgc3Rl cCA9IGZvcmNlX2dpbXBsZV9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IChkb3Vi bGVfaW50X29uZV9wIChzY2FsZSkpCiAgICAgewogICAgICAgaWYgKCFleHBy KQotCXJldHVybiBlbHQ7CisJcmV0dXJuIGZvbGRfY29udmVydCAodHlwZSwg ZWx0KTsKIAorICAgICAgaWYgKFBPSU5URVJfVFlQRV9QICh0eXBlKSkKKyAg ICAgICAgcmV0dXJuIGZvbGRfYnVpbGQyIChQT0lOVEVSX1BMVVNfRVhQUiwg dHlwZSwgZXhwciwgZWx0KTsKICAgICAgIHJldHVybiBmb2xkX2J1aWxkMiAo UExVU19FWFBSLCB0eXBlLCBleHByLCBlbHQpOwogICAgIH0KIAogICBpZiAo ZG91YmxlX2ludF9taW51c19vbmVfcCAoc2NhbGUpKQogICAgIHsKICAgICAg IGlmICghZXhwcikKLQlyZXR1cm4gZm9sZF9idWlsZDEgKE5FR0FURV9FWFBS LCB0eXBlLCBlbHQpOworCXJldHVybiBmb2xkX2NvbnZlcnQgKHR5cGUsIGZv bGRfYnVpbGQxIChORUdBVEVfRVhQUiwgdHlwZTEsIGVsdCkpOwogCisgICAg ICBpZiAoUE9JTlRFUl9UWVBFX1AgKHR5cGUpKQorCXsKKwkgIGVsdCA9IGZv bGRfYnVpbGQxIChORUdBVEVfRVhQUiwgdHlwZTEsIGVsdCk7CisJICByZXR1 cm4gZm9sZF9idWlsZDIgKFBPSU5URVJfUExVU19FWFBSLCB0eXBlLCBleHBy LCBlbHQpOworCX0KICAgICAgIHJldHVybiBmb2xkX2J1aWxkMiAoTUlOVVNf RVhQUiwgdHlwZSwgZXhwciwgZWx0KTsKICAgICB9CiAKICAgaWYgKCFleHBy KQotICAgIHJldHVybiBmb2xkX2J1aWxkMiAoTVVMVF9FWFBSLCB0eXBlLCBl bHQsCi0JCQlkb3VibGVfaW50X3RvX3RyZWUgKHR5cGUsIHNjYWxlKSk7Cisg ICAgcmV0dXJuIGZvbGRfY29udmVydCAodHlwZSwKKwkJCSBmb2xkX2J1aWxk MiAoTVVMVF9FWFBSLCB0eXBl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CiAgIGdjY19hc3NlcnQg KGNvbWItPm4gPT0gTUFYX0FGRl9FTFRTIHx8IGNvbWItPnJlc3QgPT0gTlVM TF9UUkVFKTsKIApAQCAtNDE1LDcgKzQzNCw3IEBAIGFmZl9jb21iaW5hdGlv bl90b190cmVlIChhZmZfdHJlZSAqY29tYikKICAgICAgIG9mZiA9IGNvbWIt Pm9mZnNldDsKICAgICAgIHNnbiA9IGRvdWJsZV9pbnRfb25lOwogICAgIH0K LSAgcmV0dXJuIGFkZF9lbHRfdG9fdHJlZSAoZXhwciwgdHlwZSwgZG91Ymxl X2ludF90b190cmVlICh0eXBlLCBvZmYpLCBzZ24sCisgIHJldHVybiBhZGRf ZWx0X3RvX3RyZWUgKGV4cHIsIHR5cGUsIGRvdWJsZV9pbnRfdG9fdHJlZSAo dHlwZTEsIG9mZiksIHNnbiwKIAkJCSAgY29tYik7CiB9CiAK ------=_Part_112330_7268805.1186489556797--