From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2112.outbound.protection.outlook.com [40.107.8.112]) by sourceware.org (Postfix) with ESMTPS id 6EDF63858D35 for ; Mon, 15 Apr 2024 13:30:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6EDF63858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=Syrmia.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Syrmia.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6EDF63858D35 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.8.112 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713187851; cv=pass; b=W9GwGSBUbnIRnkXYlv0kiBbq2pWnGmar6Jtg4sDUTuI37UP4mnKT9/FUUNyHoAlBM0UGeWZ0DfMW+rknC3Z2YINeLUufSZZRXvGusMOM7DQIS0zYI5YYQp11ydTlhptbt3Y7cnM8kNT/MryuiAxUzJ6NQ8aHH1iKBxe/NRjDY4I= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713187851; c=relaxed/simple; bh=oMT+WSBTlkExrrlgTKeA8uuWKSfH5tancVlsPIcIdKk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Nrc0wspjnni449O1pG/W3VACJ2gx9oImFNgElS9cMIJlqDy1JQtid+iwdsK2AfTDFQKd/y4YxgJFFxsBCONv03GsbirV+otaSE/1Tjcwi9fgCtDUxgUwIxlzSx2LoaEyRAoLefv63gFgQX0zvF/Qxd9UtUzVsjKrGwy+0clSj4Y= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jVjJXbQta2x1AV1M5xWub5GU1vgu4lR1eDAa+7DCPg4yPRH5hlJEvF1iVycCmdeDeCziXB/cdntrMZ13Uf1PrHexTkNXGAoEPBiWZdr2uWUumKbWjY3i3cZInSi8bURPKEMx3jWOcWvelxpoFE1Dgax/Z/ohcgaZLbFxGOT3oC6dca2GdPu2eX9AJ4pfY46ddNKWEiu73ZltvMr6gw5QylTBj9K5Pkttr0JQOvOjwrJzc7wPn7J27ffHikpwmQH+K30cn/t3HlYmKAO2nKnjRhgYU7z5hJucMQeemibOcqN9MH8M8TO0qWxgC2ZPigVqZveCmMqYwpMwmr+IrH29UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hSMU9dAYQcNtD5j/jTnaep/C2R3W/6rwIK2TSQynamc=; b=MlLZFD5Oljbr1NY0TMWhofSTWo6b3S9vzqelxQKkYOXXXhv23pG+oa8C3mtZeF6Z0GsEoIoFmkW13De+lVfWWugfEfRocXVOV825mNA9YDxeALUti1JBIP7IbY0yzTN49p0uZc7r5JcaJ5UmRQNlhaKhmw2NxfY9Wud6Rk7QAYTS3Olo0EVGAGF58zsrLc4phCN/OJ/qpUE4Q7hjU3p9sTAFmBZx3srI4gpzvx8aALXtmmcJwMHyX7GDMPQRVVUYl/NFpIgTTG29J0Ft4AlsGTfs7JXqR86A1+YwtjreqbB70/+sGdGrals2jtE9681GoPdmDwrLupJn/50m0Ay3Cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hSMU9dAYQcNtD5j/jTnaep/C2R3W/6rwIK2TSQynamc=; b=AmHa1H17CG85StPa2H+AvM1SSU3acEbXRC+VaArLCMeRu5v5dXPrXXDPoaXEd5cbXNzPGtJNz++i+yQQLA918Yj8Sf5gumGjdbFIdWEfueaGEECWNTg2gQzxlcoQUxyesBtxD1LRChUiwqKe7EOclxrUGxVzEfkcQ8CMBhSq9bA= Received: from AM0PR03MB4611.eurprd03.prod.outlook.com (2603:10a6:208:c8::32) by DU5PR03MB10217.eurprd03.prod.outlook.com (2603:10a6:10:517::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.49; Mon, 15 Apr 2024 13:30:36 +0000 Received: from AM0PR03MB4611.eurprd03.prod.outlook.com ([fe80::7310:4f7f:5524:8049]) by AM0PR03MB4611.eurprd03.prod.outlook.com ([fe80::7310:4f7f:5524:8049%7]) with mapi id 15.20.7452.049; Mon, 15 Apr 2024 13:30:36 +0000 From: Aleksandar Rakic To: "gcc-patches@gcc.gnu.org" CC: "richard.guenther@gmail.com" , "jeffreyalaw@gmail.com" , Djordje Todorovic , Jovan Dmitrovic Subject: Re: [PATCH 1/2] ivopts: Revert computation of address cost complexity. Thread-Topic: [PATCH 1/2] ivopts: Revert computation of address cost complexity. Thread-Index: AQHaeW8jjazwY2hLyE+saoVjO+5aPrFpfrPn Date: Mon, 15 Apr 2024 13:30:36 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=Syrmia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM0PR03MB4611:EE_|DU5PR03MB10217:EE_ x-ms-office365-filtering-correlation-id: b5b3e56c-8951-4aa1-0ce1-08dc5d503c21 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Au9cGYu1VySfiLJXtPBckx0vq3R0BIgwAInoXcRWjh+uWzZcIdwKb85+E9+Jhs3LPFBIoFp1Ebhmks5j5ntF+zzG5Cn5yZZSyEfzbGIuS2HqkyFPTtOsVB2Ljid/LDS46B1AbriM3NJJd0CAUQuaXu938L4RjGF0nltVIFwbcc5NWzMT7+CNZ6hNsYFa5J3JGbpeGAUcCnuc96GU2eMYaUb+pfjXRWJW9/6snSbSdg42BpWc4lzwcjM2PbbqWCpgWJPCr0egglOrrGufG8iFPOpgth+XBne8cdK3YHrtshQGXLEdZYx/MO1ox0ZAE92HDIGCl3ggpCq+of/zFW1s94Ep4futQ4czDqHTlMaVyceJmI/lBhsPQzeUmPAt8DyaH3G77T8G2uAklYbVSypdFLfuAx+Hw3LinLxNJDrhizLdgNNgusVhCKJhClyYmGq2arLeI1gqQY+WRzWr6O/cnzS/U8iubawb37JG5nNe4qJB3q4MlpnaDMZqJTehyc0NUppr3eMmqtjpkZFk0ia6eCQvWLouP5+HsJROam6aRScCu26ZwGZlnYfqXpu9uguytpdx9zyiGvH5ZlEj1ZizthyEn3fQzrq6QcnRhgDnQwou1G9L/jwztcp6H6r6JP1EEDnh4qgDYKL3OxnQ+kxlNp8LJgTbvON4WzRjvsIILGyCMNVhv6YczJAY5xa3lKSF6Mbd0aEXf0+Hjb2nrzFstg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR03MB4611.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(1800799015)(38070700009);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-2?Q?uGNXJdEcelgsaRFiamDfiARw1Oqp8KSIMZlpzWrLBge72EPJ5W+70zEZYy?= =?iso-8859-2?Q?SaaCzAOLAcduj4k/yUwvYS/N9fkmlotJAnS1st6qRGsk39ccjLWxVHSLbl?= =?iso-8859-2?Q?TfgLtxgL0Y00L2vYeEH/cR/feHyKqYb2HWWTw09Sh3mevUJdm8jm/fSqeD?= =?iso-8859-2?Q?SZbf/yUcW5FDaBOzQC2HCF5ukv1okl4YaxiIuAnafrq2RzDtFxhm/ycVAG?= =?iso-8859-2?Q?rA6rIn/HIdKuVnDukMMq+gpzX2BHHxWcRFKchaQdvKT2WPbkKCFV0coBSi?= =?iso-8859-2?Q?eJSTM90/usvR+goXbDregzNcoXd0X7y385jMTARbNtpWbaKM9V5cXyoMm1?= =?iso-8859-2?Q?hQEW9eeVI9uYFH1ahnN+1S73nkTYisaGZapNArZpvg1RFWpPwl4mTyeAkz?= =?iso-8859-2?Q?THYOvaoO12OLbuHx6vxqO0XaRnRZeNABwGoL8xbsbw0kGbMubyMpw1SGQ0?= =?iso-8859-2?Q?SMHEKUKXPna+av46HiCduE76afOxYjFoDpgXRs5uSdrTiybQBRU1FNL5qW?= =?iso-8859-2?Q?ix7YTXlPVAL+pdHF6tHUSWqbnogP4eR901ncjx4DJrwxkwt6NOQXPmMoX+?= =?iso-8859-2?Q?yAqp0mh7JXBzeyeLHkOLZlcHXXm/fOrR/GfUJbob2/eQ0dCCuXBIR0z9wp?= =?iso-8859-2?Q?CVnZDeOBvtpZuIEW3lm+aebmZyv0ujrC98A/ExkVQ9Ixg+2NWHwYOGHCVk?= =?iso-8859-2?Q?FbcVzZ+BmRAjsYEos2ggD+h3HXjSncY8MLgUCNrlAVunVwfnnxsbNclGDy?= =?iso-8859-2?Q?LG4nZOh+3owJ9gCTFvRCRZDTGXWRm0bT5USeVF5SqB3bV7DcjRIMf5laQg?= =?iso-8859-2?Q?3m979AlVzpJ9rhgpmYeYUkQnCczAVOGOhYEtn/g7JsTvQeLWWwG/Li96DP?= =?iso-8859-2?Q?LfiqKe/YpDulHN+tB5WjwIOEOxrUJLx1VQharmuF9ItcUYkieaxNWNjBXz?= =?iso-8859-2?Q?L3ppYutoZvJb+hRmwj+GkZpPEgTdsDXO3g3w1FjTr83MNLB2WL1Ts6wPoq?= =?iso-8859-2?Q?oHeF0VZQ6fTxfBtFVTlW7VDJ0e9ehZwAHbbtcVQJGgk1/pBM1FDFmZpWfX?= =?iso-8859-2?Q?X0R9qdxLbdpDK4fGXq9tU/70vLwOhc6SUPNtJTcTy5ixMaBoAN4Rd9jf/e?= =?iso-8859-2?Q?QtBfXB0iFqvv3d5DNIdz7DDZ7u9b9d0irol9GkQskgX6MuHnEGnH0PLcnA?= =?iso-8859-2?Q?2G5b9tpCNNqzPH8P48mjUMH+5WRC2qDICme9VIxykbddLcdSKpEjDdpYKp?= =?iso-8859-2?Q?sIqR7K6dHi219mzBdRszNIteTGqXxdcsobX1Z5shnlM0XcjsfQL5crr1jn?= =?iso-8859-2?Q?h7GBz6nFnAjs80gi/EAT3lksDhrtaA+BO3j0eFFCDjkwPV+qklfN18F/AK?= =?iso-8859-2?Q?vxpDekwrhyRENTiVeN0AOq4OUrk9NcIDP257wJT94Gv9E2wWHhbIkdhdKX?= =?iso-8859-2?Q?dCxwqBK+6DJTlkpQXN254NygLTTYXfcNoFrGVvUZK5xVb5iDJn9l0ZiDZW?= =?iso-8859-2?Q?1n31VT8A+ZheKDkU6ZQksXhyMqGSLH/HdAiYQ+6NWOJxBKttqv66KJYakt?= =?iso-8859-2?Q?AOcHZ/8SwX/9ajY4rUV7D+0gdAEmwG/q5CGTByEAf/bBxrjoV8kQW7bxGR?= =?iso-8859-2?Q?1uMBjMCBIjmAn2tKvacK4FvAAMp9yQxmqK?= Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR03MB4611.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5b3e56c-8951-4aa1-0ce1-08dc5d503c21 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2024 13:30:36.7307 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: U5aJoiRCaIqo1/RVdl9f/GyMeo5MwoA/42UoBqpHlIfqIkkZKmqaw9aeuVejJ6gSwoPK/M4KmBFsJnA3Youn4RCtkifYdv2xOIWGUrpT/LU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU5PR03MB10217 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: PING: I remind you that the patch for the computation of complexity for uns= upported addressing modes has been sent. ________________________________________ From: Aleksandar Rakic Sent: Monday, March 18, 2024 9:27 PM To: gcc-patches@gcc.gnu.org Cc: Jovan Dmitrovic; richard.guenther@gmail.com; Djordje Todorovic; jeffrey= alaw@gmail.com; Uros Beric Subject: Re: [PATCH 1/2] ivopts: Revert computation of address cost complex= ity. >From dbf49f2872efcc14d2ea41eb7d616498dca9789f Mon Sep 17 00:00:00 2001 From: Aleksandar Raki=E6 Date: Tue, 5 Mar 2024 11:55:01 +0100 Subject: [PATCH] ivopts: Fixed bug 109429 This patch modifies the order of the complexity calculation. By fixing the complexities, the candidate selection is also fixed, which leads to the sma= ller code size. This patch also fixes the complexity if the variable is present in the address expression, similarly to the variable 'var_present' in the commit c2b64ce. It also differentiates the adding of the autoinc_cost and the address cost (acost) to the cost, similarly to the commit c2b64ce. It also contains the C test and the script that generates the assembly file and the output of the compiler. The assembly code obtained after the modification of the file tree-ssa-loop-ivopts.cc is smaller in size than the assembly code obtained before that. The output of the compiler shows the difference in complexities for the function dgefa for the loop 3 for the group 1. This patch is available on the gcc fork on the following address: https://github.com/rakicaleksandar1999/gcc/tree/bug_109429. The description of the bug 109429 is on the following address: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109429. gcc/ChangeLog: * tree-ssa-loop-ivopts.cc (get_address_cost): Fixed the complexities calculation. gcc/testsuite/ChangeLog: * after.s: The assembly file obtained by compiling the fp_foo.c file after modification of the tree-ssa-loop-ivopts.cc file. * after.txt: The compiler-generated output obtained by compiling the fp_foo.c file after modification of the tree-ssa-loop-ivopts.cc file. * before.s: The assembly file obtained by compiling the fp_foo.c file before modification of the tree-ssa-loop-ivopts.cc file. * before.txt: The compiler-generated output obtained by compiling the fp_foo.c file before modification of the tree-ssa-loop-ivopts.cc file. * fp_foo.c: The C test. * test_script.sh: The script used for compiling the fp_foo.c file. Signed-off-by: Aleksandar Raki=E6 --- gcc/testsuite/after.s | 148 ++ gcc/testsuite/after.txt | 2792 ++++++++++++++++++++++++++++++++++ gcc/testsuite/before.s | 152 ++ gcc/testsuite/before.txt | 2694 ++++++++++++++++++++++++++++++++ gcc/testsuite/fp_foo.c | 19 + gcc/testsuite/test_script.sh | 10 + gcc/tree-ssa-loop-ivopts.cc | 75 +- 7 files changed, 5853 insertions(+), 37 deletions(-) create mode 100644 gcc/testsuite/after.s create mode 100644 gcc/testsuite/after.txt create mode 100644 gcc/testsuite/before.s create mode 100644 gcc/testsuite/before.txt create mode 100644 gcc/testsuite/fp_foo.c create mode 100644 gcc/testsuite/test_script.sh diff --git a/gcc/testsuite/after.s b/gcc/testsuite/after.s new file mode 100644 index 00000000000..a32bb8b3614 --- /dev/null +++ b/gcc/testsuite/after.s @@ -0,0 +1,148 @@ + .file 1 "fp_foo.c" + .section .mdebug.abi64 + .previous + .nan 2008 + .module fp=3D64 + .module oddspreg + .module arch=3Dmips64r6 + .abicalls + .text + .align 2 + .align 3 + .globl daxpy + .set nomips16 + .set nomicromips + .ent daxpy + .type daxpy, @function +daxpy: + .frame $sp,0,$31 # vars=3D 0, regs=3D 0/0, args=3D 0= , gp=3D 0 + .mask 0x00000000,0 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + blezc $6,.L7 + dlsa $6,$6,$4,2 + .align 3 +.L3: + lwc1 $f1,0($5) + daddiu $4,$4,4 + lwc1 $f0,-4($4) + daddiu $5,$5,4 + maddf.s $f0,$f1,$f15 + bne $4,$6,.L3 + swc1 $f0,-4($4) + +.L7: + jrc $31 + .set macro + .set reorder + .end daxpy + .size daxpy, .-daxpy + .align 2 + .align 3 + .globl dgefa + .set nomips16 + .set nomicromips + .ent dgefa + .type dgefa, @function +dgefa: + .frame $sp,48,$31 # vars=3D 0, regs=3D 5/0, args=3D 0= , gp=3D 0 + .mask 0x100f0000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + li $2,1 # 0x1 + bgec $2,$6,.L23 + daddiu $sp,$sp,-48 + addiu $14,$6,-1 + move $10,$6 + sd $19,32($sp) + sd $18,24($sp) + move $11,$4 + sd $17,16($sp) + move $17,$5 + sd $16,8($sp) + dlsa $9,$7,$4,2 + addiu $19,$5,1 + dsll $12,$5,2 + move $25,$5 + move $24,$0 + move $13,$0 + move $15,$0 + move $18,$14 + .align 3 +.L11: + addiu $7,$15,1 + addiu $16,$15,1 + daddiu $13,$13,1 + move $15,$7 + bgec $7,$10,.L15 + daddiu $8,$24,1 + daddu $6,$13,$25 + dlsa $8,$8,$11,2 + dsll $6,$6,2 + move $5,$14 + .align 3 +.L14: + daddu $2,$9,$6 + daddu $4,$11,$6 + lwc1 $f2,-4($2) + move $3,$0 + move $2,$8 + .align 3 +.L13: + lwc1 $f1,0($4) + daddiu $2,$2,4 + lwc1 $f0,-4($2) + addiu $3,$3,1 + daddiu $4,$4,4 + maddf.s $f0,$f2,$f1 + swc1 $f0,-4($2) + bltc $3,$5,.L13 + addiu $7,$7,1 + bne $10,$7,.L14 + daddu $6,$6,$12 + +.L15: + addiu $14,$14,-1 + daddiu $9,$9,-4 + addu $24,$24,$19 + bne $18,$16,.L11 + addu $25,$17,$25 + + ld $19,32($sp) + ld $18,24($sp) + ld $17,16($sp) + ld $16,8($sp) + jr $31 + daddiu $sp,$sp,48 + +.L23: + jrc $31 + .set macro + .set reorder + .end dgefa + .size dgefa, .-dgefa + .section .text.startup,"ax",@progbits + .align 2 + .align 3 + .globl main + .set nomips16 + .set nomicromips + .ent main + .type main, @function +main: + .frame $sp,0,$31 # vars=3D 0, regs=3D 0/0, args=3D 0= , gp=3D 0 + .mask 0x00000000,0 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + jr $31 + move $2,$0 + + .set macro + .set reorder + .end main + .size main, .-main + .ident "GCC: (GNU) 14.0.1 20240214 (experimental)" + .section .note.GNU-stack,"",@progbits diff --git a/gcc/testsuite/after.txt b/gcc/testsuite/after.txt new file mode 100644 index 00000000000..772f92d2b20 --- /dev/null +++ b/gcc/testsuite/after.txt @@ -0,0 +1,2792 @@ +tree_ssa_iv_optimize +;; +;; Loop 1 +;; header 3, latch 6 +;; depth 1, outer 0, finite_p +;; niter (unsigned int) n_12(D) + 4294967295 +;; upper_bound 2147483646 +;; likely_upper_bound 2147483646 +;; iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 05119324 (estimated locally, freq 0.8900) +;; nodes: 3 6 +Processing loop 1 at fp_foo.c:3 + single exit 3 -> 7, exit condition if (n_12(D) > i_17) + + + +Loops in function: daxpy +loop_0 (header =3D 0, latch =3D 1) +{ + bb_2 (preds =3D {bb_0 }, succs =3D {bb_5 bb_4 }) + { + [local count: 118111600]: + if (n_12(D) > 0) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_5 (preds =3D {bb_2 }, succs =3D {bb_3 }) + { + [local count: 105119324]: + + } + bb_7 (preds =3D {bb_3 }, succs =3D {bb_4 }) + { + [local count: 105119324]: + # .MEM_22 =3D PHI <.MEM_16(3)> + + } + bb_4 (preds =3D {bb_2 bb_7 }, succs =3D {bb_1 }) + { + [local count: 118111600]: + # .MEM_29 =3D PHI <.MEM_11(D)(2), .MEM_22(7)> + # VUSE <.MEM_29> + return; + + } + loop_1 (header =3D 3, latch =3D 6, finite_p + niter (unsigned int) n_12(D) + 4294967295 + upper_bound 2147483646 + likely_upper_bound 2147483646 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:105= 119324 (estimated locally, freq 0.8900)) + { + bb_3 (preds =3D {bb_6 bb_5 }, succs =3D {bb_6 bb_7 }) + { + [local count: 955630224]: + # i_20 =3D PHI + # .MEM_21 =3D PHI <.MEM_16(6), .MEM_11(D)(5)> + _1 =3D (long unsigned int) i_20; + _2 =3D _1 * 4; + _3 =3D vector1_13(D) + _2; + # VUSE <.MEM_21> + _4 =3D *_3; + _5 =3D vector2_14(D) + _2; + # VUSE <.MEM_21> + _6 =3D *_5; + _7 =3D _6 * fp_const_15(D); + _8 =3D _4 + _7; + # .MEM_16 =3D VDEF <.MEM_21> + *_3 =3D _8; + i_17 =3D i_20 + 1; + if (n_12(D) > i_17) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_6 (preds =3D {bb_3 }, succs =3D {bb_3 }) + { + [local count: 850510900]: + goto ; [100.00%] + + } + } +} +Analyzing # of iterations of loop 1 + exit condition [1, + , 1](no_overflow) < n_12(D) + bounds on difference of bases: 0 ... 2147483646 + result: + # of iterations (unsigned int) n_12(D) + 4294967295, bounded by 214748= 3646 + number of iterations (unsigned int) n_12(D) + 4294967295 + +: +IV struct: + SSA_NAME: _1 + Type: long unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _2 + Type: long unsigned int + Base: 0 + Step: 4 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _3 + Type: float * + Base: vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _5 + Type: float * + Base: vector2_14(D) + Step: 4 + Object: (void *) vector2_14(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: i_17 + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: i_20 + Type: int + Base: 0 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow + +: +Group 0: + Type: REFERENCE ADDRESS + Use 0.0: + At stmt: _4 =3D *_3; + At pos: *_3 + IV struct: + Type: float * + Base: vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: Overflow + Use 0.1: + At stmt: *_3 =3D _8; + At pos: *_3 + IV struct: + Type: float * + Base: vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 1: + Type: REFERENCE ADDRESS + Use 1.0: + At stmt: _6 =3D *_5; + At pos: *_5 + IV struct: + Type: float * + Base: vector2_14(D) + Step: 4 + Object: (void *) vector2_14(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 2: + Type: COMPARE + Use 2.0: + At stmt: if (n_12(D) > i_17) + At pos: i_17 + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow + +Predict doloop failure due to target specific checks. +Candidate 0: + Var befor: ivtmp.6 + Var after: ivtmp.6 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 1: + Var befor: ivtmp.7 + Var after: ivtmp.7 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 2: + Var befor: ivtmp.8 + Var after: ivtmp.8 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Var befor: ivtmp.9 + Var after: ivtmp.9 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Var befor: ivtmp.10 + Var after: ivtmp.10 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) vector2_14(D) + Step: 4 + Object: (void *) vector2_14(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.11 + Var after: ivtmp.11 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 7: + Var befor: ivtmp.12 + Var after: ivtmp.12 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 0 + Step: 4 + Biv: N + Overflowness wrto loop niter: No-overflow + +: 0, 1, 2, 3, + + Related: + Group 0: 0, 1, 2, 3, 4, 7 + Group 1: 0, 1, 2, 3, 5, 7 + Group 2: 0, 1, 2, 3, 6 + +: + cand cost +force_expr_to_var_cost size costs: + integer 0 + symbol 5 + address 5 + other 24 + +force_expr_to_var_cost speed costs: + integer 0 + symbol 5 + address 5 + other 24 + + 0 5 + 1 5 + 2 5 + 3 4 + 4 5 + 5 5 + 6 5 + 7 5 + + +: +Inv 4: n_12(D) (eliminable) +Inv 1: vector1_13(D) (eliminable) +Inv 2: vector2_14(D) (eliminable) +Inv 3: fp_const_15(D) (eliminable) + +: +inv_expr 1: (unsigned long) n_12(D) * 4 + (unsigned long) vector1_13(D) +inv_expr 2: (unsigned long) n_12(D) * 4 + (unsigned long) vector2_14(D) + +: +Group 0: + cand cost compl. inv.expr. inv.vars + 1 18 2 NIL; 1 + 2 18 4 NIL; 1 + 4 2 0 NIL; NIL; + 7 10 2 NIL; 1 + +Group 1: + cand cost compl. inv.expr. inv.vars + 1 9 1 NIL; 2 + 2 9 2 NIL; 2 + 5 1 0 NIL; NIL; + 7 5 1 NIL; 2 + +Group 2: + cand cost compl. inv.expr. inv.vars + 0 0 0 NIL; 4 + 1 0 0 NIL; 4 + 2 1 0 NIL; 4 + 3 0 0 NIL; 4 + 4 1 0 1; NIL; + 5 1 0 2; NIL; + 6 0 0 NIL; 4 + 7 1 0 NIL; 4 + + +: + target_avail_regs 26 + target_clobbered_regs 16 + target_reg_cost 4 + target_spill_cost 24 + regs_used 0 + cost for size: + ivs cost + 0 0 + 1 2 + 2 4 + 3 6 + 4 8 + 5 10 + 6 12 + 7 14 + 8 16 + 9 18 + 10 20 + 11 22 + 12 24 + 13 26 + 14 28 + 15 30 + 16 32 + 17 34 + 18 36 + 19 38 + 20 40 + 21 42 + 22 44 + 23 115 + 24 120 + 25 125 + 26 130 + 27 179 + 28 228 + 29 277 + 30 326 + 31 375 + 32 424 + 33 473 + 34 522 + 35 571 + 36 620 + 37 669 + 38 718 + 39 767 + 40 816 + 41 865 + 42 914 + 43 963 + 44 1012 + 45 1061 + 46 1110 + 47 1159 + 48 1208 + 49 1257 + 50 1306 + 51 1355 + 52 1404 + +Initial set of candidates: + cost: 37 (complexity 3) + reg_cost: 5 + cand_cost: 5 + cand_group_cost: 27 (complexity 3) + candidates: 1 + group:0 --> iv_cand:1, cost=3D(18,2) + group:1 --> iv_cand:1, cost=3D(9,1) + group:2 --> iv_cand:1, cost=3D(0,0) + invariant variables: 1, 2, 4 + invariant expressions: + +Improved to: + cost: 26 (complexity 3) + reg_cost: 5 + cand_cost: 5 + cand_group_cost: 16 (complexity 3) + candidates: 7 + group:0 --> iv_cand:7, cost=3D(10,2) + group:1 --> iv_cand:7, cost=3D(5,1) + group:2 --> iv_cand:7, cost=3D(1,0) + invariant variables: 1, 2, 4 + invariant expressions: + +Improved to: + cost: 24 (complexity 1) + reg_cost: 6 + cand_cost: 10 + cand_group_cost: 8 (complexity 1) + candidates: 4, 7 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:7, cost=3D(5,1) + group:2 --> iv_cand:7, cost=3D(1,0) + invariant variables: 2, 4 + invariant expressions: + +Improved to: + cost: 19 (complexity 0) + reg_cost: 5 + cand_cost: 10 + cand_group_cost: 4 (complexity 0) + candidates: 4, 5 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:5, cost=3D(1,0) + group:2 --> iv_cand:4, cost=3D(1,0) + invariant variables: + invariant expressions: 1 + +Initial set of candidates: + cost: 26 (complexity 3) + reg_cost: 5 + cand_cost: 5 + cand_group_cost: 16 (complexity 3) + candidates: 7 + group:0 --> iv_cand:7, cost=3D(10,2) + group:1 --> iv_cand:7, cost=3D(5,1) + group:2 --> iv_cand:7, cost=3D(1,0) + invariant variables: 1, 2, 4 + invariant expressions: + +Improved to: + cost: 24 (complexity 1) + reg_cost: 6 + cand_cost: 10 + cand_group_cost: 8 (complexity 1) + candidates: 4, 7 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:7, cost=3D(5,1) + group:2 --> iv_cand:7, cost=3D(1,0) + invariant variables: 2, 4 + invariant expressions: + +Improved to: + cost: 19 (complexity 0) + reg_cost: 5 + cand_cost: 10 + cand_group_cost: 4 (complexity 0) + candidates: 4, 5 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:5, cost=3D(1,0) + group:2 --> iv_cand:4, cost=3D(1,0) + invariant variables: + invariant expressions: 1 + +Original cost 19 (complexity 0) + +Final cost 19 (complexity 0) + +Selected IV set for loop 1 at fp_foo.c:3, 10 avg niters, 2 IVs: +Candidate 4: + Var befor: ivtmp.9_28 + Var after: ivtmp.9_27 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Var befor: ivtmp.10_25 + Var after: ivtmp.10_24 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) vector2_14(D) + Step: 4 + Object: (void *) vector2_14(D) + Biv: N + Overflowness wrto loop niter: Overflow + +Replacing exit test: if (n_12(D) > i_17) +tree_ssa_iv_optimize +;; +;; Loop 3 +;; header 8, latch 13 +;; depth 3, outer 2, finite_p +;; niter _87 > 0 ? (unsigned int) _87 + 4294967295 : 0 +;; upper_bound 2147483645 +;; likely_upper_bound 2147483645 +;; iterations by profile: 7.090909 (unreliable, maybe flat) entry count:1= 18111600 (estimated locally, freq 65.4628) +;; nodes: 8 13 +Processing loop 3 at fp_foo.c:3 + single exit 8 -> 9, exit condition if (i_40 < _87) + + + +Loops in function: dgefa +loop_0 (header =3D 0, latch =3D 1) +{ + bb_2 (preds =3D {bb_0 }, succs =3D {bb_10 bb_14 }) + { + [local count: 1804255]: + _45 =3D n_23(D) + -1; + if (n_23(D) > 1) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_14 (preds =3D {bb_2 }, succs =3D {bb_3 }) + { + [local count: 198468]: + + } + bb_3 (preds =3D {bb_14 bb_16 }, succs =3D {bb_1 }) + { + [local count: 1804255]: + # .MEM_88 =3D PHI <.MEM_22(D)(14), .MEM_53(16)> + # VUSE <.MEM_88> + return; + + } + bb_10 (preds =3D {bb_2 }, succs =3D {bb_4 }) + { + [local count: 1605787]: + + } + bb_16 (preds =3D {bb_5 }, succs =3D {bb_3 }) + { + [local count: 1605787]: + # .MEM_53 =3D PHI <.MEM_89(5)> + goto ; [100.00%] + + } + loop_1 (header =3D 4, latch =3D 11, finite_p + niter (unsigned int) n_23(D) + 4294967294 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:160= 5787 (estimated locally, freq 0.8900)) + { + bb_4 (preds =3D {bb_11 bb_10 }, succs =3D {bb_6 bb_15 }) + { + [local count: 14598063]: + # i_50 =3D PHI + # .MEM_54 =3D PHI <.MEM_89(11), .MEM_22(D)(10)> + j_24 =3D i_50 + 1; + if (n_23(D) > j_24) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_15 (preds =3D {bb_4 }, succs =3D {bb_5 }) + { + [local count: 1605787]: + + } + bb_5 (preds =3D {bb_15 bb_17 }, succs =3D {bb_11 bb_16 }) + { + [local count: 14598063]: + # .MEM_89 =3D PHI <.MEM_54(15), .MEM_86(17)> + if (j_24 < _45) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_11 (preds =3D {bb_5 }, succs =3D {bb_4 }) + { + [local count: 12992276]: + goto ; [100.00%] + + } + bb_6 (preds =3D {bb_4 }, succs =3D {bb_7 }) + { + [local count: 12992276]: + _6 =3D m_25(D) * i_50; + _7 =3D _6 + i_50; + _8 =3D (sizetype) _7; + _9 =3D _8 + 1; + _10 =3D _9 * 4; + _87 =3D n_23(D) - j_24; + + } + bb_17 (preds =3D {bb_9 }, succs =3D {bb_5 }) + { + [local count: 12992276]: + # .MEM_86 =3D PHI <.MEM_55(9)> + goto ; [100.00%] + + } + loop_2 (header =3D 7, latch =3D 12, finite_p + niter ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 2992276 (estimated locally, freq 7.2009)) + { + bb_7 (preds =3D {bb_12 bb_6 }, succs =3D {bb_8 }) + { + [local count: 118111600]: + # j_51 =3D PHI + # .MEM_52 =3D PHI <.MEM_55(12), .MEM_54(6)> + _1 =3D m_25(D) * j_51; + _2 =3D _1 + l_26(D); + _3 =3D (long unsigned int) _2; + _4 =3D _3 * 4; + _5 =3D vector_27(D) + _4; + # VUSE <.MEM_52> + t_28 =3D *_5; + _11 =3D _1 + i_50; + _12 =3D (sizetype) _11; + _13 =3D _12 + 1; + _14 =3D _13 * 4; + + } + bb_9 (preds =3D {bb_8 }, succs =3D {bb_12 bb_17 }) + { + [local count: 118111600]: + # .MEM_55 =3D PHI <.MEM_42(8)> + j_30 =3D j_51 + 1; + if (n_23(D) > j_30) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_12 (preds =3D {bb_9 }, succs =3D {bb_7 }) + { + [local count: 105119324]: + goto ; [100.00%] + + } + loop_3 (header =3D 8, latch =3D 13, finite_p + niter _87 > 0 ? (unsigned int) _87 + 4294967295 : 0 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 7.090909 (unreliable, maybe flat) entry count= :118111600 (estimated locally, freq 65.4628)) + { + bb_8 (preds =3D {bb_13 bb_7 }, succs =3D {bb_13 bb_9 }) + { + [local count: 955630225]: + # i_56 =3D PHI + # .MEM_57 =3D PHI <.MEM_42(13), .MEM_52(7)> + _32 =3D (long unsigned int) i_56; + _33 =3D _32 * 4; + _21 =3D _10 + _33; + _34 =3D vector_27(D) + _21; + # VUSE <.MEM_57> + _35 =3D *_34; + _29 =3D _14 + _33; + _36 =3D vector_27(D) + _29; + # VUSE <.MEM_57> + _37 =3D *_36; + _38 =3D t_28 * _37; + _39 =3D _35 + _38; + # .MEM_42 =3D VDEF <.MEM_57> + *_34 =3D _39; + i_40 =3D i_56 + 1; + if (i_40 < _87) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_13 (preds =3D {bb_8 }, succs =3D {bb_8 }) + { + [local count: 850510901]: + goto ; [100.00%] + + } + } + } + } +} +Analyzing # of iterations of loop 3 + exit condition [1, + , 1](no_overflow) < _87 + bounds on difference of bases: -2147483649 ... 2147483646 + result: + zero if _87 <=3D 0 + # of iterations (unsigned int) _87 + 4294967295, bounded by 2147483646 + number of iterations (unsigned int) _87 + 4294967295; zero if _87 <=3D 0 + +: +IV struct: + SSA_NAME: _21 + Type: sizetype + Base: ((sizetype) _7 + 1) * 4 + Step: 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _29 + Type: sizetype + Base: ((sizetype) _11 + 1) * 4 + Step: 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _32 + Type: long unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _33 + Type: long unsigned int + Base: 0 + Step: 4 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _34 + Type: float * + Base: vector_27(D) + ((sizetype) _7 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _36 + Type: float * + Base: vector_27(D) + ((sizetype) _11 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: i_40 + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: i_56 + Type: int + Base: 0 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow + +: +Group 0: + Type: REFERENCE ADDRESS + Use 0.0: + At stmt: _35 =3D *_34; + At pos: *_34 + IV struct: + Type: float * + Base: vector_27(D) + ((sizetype) _7 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow + Use 0.1: + At stmt: *_34 =3D _39; + At pos: *_34 + IV struct: + Type: float * + Base: vector_27(D) + ((sizetype) _7 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 1: + Type: REFERENCE ADDRESS + Use 1.0: + At stmt: _37 =3D *_36; + At pos: *_36 + IV struct: + Type: float * + Base: vector_27(D) + ((sizetype) _11 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 2: + Type: COMPARE + Use 2.0: + At stmt: if (i_40 < _87) + At pos: i_40 + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow + +Predict doloop failure due to target specific checks. +Candidate 0: + Var befor: ivtmp.20 + Var after: ivtmp.20 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 1: + Var befor: ivtmp.21 + Var after: ivtmp.21 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 2: + Var befor: ivtmp.22 + Var after: ivtmp.22 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Var befor: ivtmp.23 + Var after: ivtmp.23 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + ((sizetype) _7 + 1) * 4) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Var befor: ivtmp.24 + Var after: ivtmp.24 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) ((sizetype) _7 * 4) + (unsigned long) vecto= r_27(D) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.25 + Var after: ivtmp.25 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + ((sizetype) _11 + 1) * 4) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 7: + Var befor: ivtmp.26 + Var after: ivtmp.26 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) ((sizetype) _11 * 4) + (unsigned long) vect= or_27(D) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 8: + Var befor: ivtmp.27 + Var after: ivtmp.27 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 9: + Var befor: ivtmp.28 + Var after: ivtmp.28 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 0 + Step: 4 + Biv: N + Overflowness wrto loop niter: No-overflow + +: 0, 1, 2, 3, + + Related: + Group 0: 0, 1, 2, 3, 4, 5, 9 + Group 1: 0, 1, 2, 3, 6, 7, 9 + Group 2: 0, 1, 2, 3, 8 + +: + cand cost + 0 5 + 1 5 + 2 5 + 3 4 + 4 6 + 5 6 + 6 6 + 7 6 + 8 5 + 9 5 + + +: +Inv 6: _7 (eliminable) +Inv 1: _10 (eliminable) +Inv 7: _11 (eliminable) +Inv 3: _14 (eliminable) +Inv 2: vector_27(D) (eliminable) +Inv 4: t_28 (eliminable) +Inv 5: _87 (eliminable) + +: +inv_expr 1: (unsigned long) _7 * 4 + (unsigned long) vector_27(D) +inv_expr 2: ((unsigned long) _7 - (unsigned long) _11) * 4 +inv_expr 3: (unsigned long) _11 * 18446744073709551612 + (unsigned long= ) _7 * 4 +inv_expr 4: (unsigned long) _11 * 4 + (unsigned long) vector_27(D) +inv_expr 5: ((unsigned long) _11 - (unsigned long) _7) * 4 +inv_expr 6: (unsigned long) _7 * 18446744073709551612 + (unsigned long)= _11 * 4 + +: +Group 0: + cand cost compl. inv.expr. inv.vars + 1 22 4 1; NIL; + 2 22 2 1; NIL; + 4 2 0 NIL; NIL; + 5 2 2 NIL; NIL; + 6 16 2 2; NIL; + 7 16 4 3; NIL; + 9 14 4 1; NIL; + +Group 1: + cand cost compl. inv.expr. inv.vars + 1 11 2 4; NIL; + 2 11 1 4; NIL; + 4 8 1 5; NIL; + 5 8 2 6; NIL; + 6 1 0 NIL; NIL; + 7 1 1 NIL; NIL; + 9 7 2 4; NIL; + +Group 2: + cand cost compl. inv.expr. inv.vars + 0 0 0 NIL; 5 + 1 0 0 NIL; 5 + 2 4 0 NIL; 5 + 3 0 0 NIL; 5 + 8 4 0 NIL; 5 + + +: + target_avail_regs 26 + target_clobbered_regs 16 + target_reg_cost 4 + target_spill_cost 24 + regs_used 0 + cost for size: + ivs cost + 0 0 + 1 2 + 2 4 + 3 6 + 4 8 + 5 10 + 6 12 + 7 14 + 8 16 + 9 18 + 10 20 + 11 22 + 12 24 + 13 26 + 14 28 + 15 30 + 16 32 + 17 34 + 18 36 + 19 38 + 20 40 + 21 42 + 22 44 + 23 115 + 24 120 + 25 125 + 26 130 + 27 179 + 28 228 + 29 277 + 30 326 + 31 375 + 32 424 + 33 473 + 34 522 + 35 571 + 36 620 + 37 669 + 38 718 + 39 767 + 40 816 + 41 865 + 42 914 + 43 963 + 44 1012 + 45 1061 + 46 1110 + 47 1159 + 48 1208 + 49 1257 + 50 1306 + 51 1355 + 52 1404 + +Initial set of candidates: + cost: 47 (complexity 3) + reg_cost: 5 + cand_cost: 5 + cand_group_cost: 37 (complexity 3) + candidates: 2 + group:0 --> iv_cand:2, cost=3D(22,2) + group:1 --> iv_cand:2, cost=3D(11,1) + group:2 --> iv_cand:2, cost=3D(4,0) + invariant variables: 5 + invariant expressions: 1, 4 + +Improved to: + cost: 31 (complexity 1) + reg_cost: 6 + cand_cost: 11 + cand_group_cost: 14 (complexity 1) + candidates: 2, 4 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:4, cost=3D(8,1) + group:2 --> iv_cand:2, cost=3D(4,0) + invariant variables: 5 + invariant expressions: 5 + +Improved to: + cost: 26 (complexity 1) + reg_cost: 6 + cand_cost: 10 + cand_group_cost: 10 (complexity 1) + candidates: 3, 4 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:4, cost=3D(8,1) + group:2 --> iv_cand:3, cost=3D(0,0) + invariant variables: 5 + invariant expressions: 5 + +Improved to: + cost: 26 (complexity 0) + reg_cost: 7 + cand_cost: 16 + cand_group_cost: 3 (complexity 0) + candidates: 3, 4, 6 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:6, cost=3D(1,0) + group:2 --> iv_cand:3, cost=3D(0,0) + invariant variables: 5 + invariant expressions: + +Initial set of candidates: + cost: 37 (complexity 6) + reg_cost: 7 + cand_cost: 9 + cand_group_cost: 21 (complexity 6) + candidates: 3, 9 + group:0 --> iv_cand:9, cost=3D(14,4) + group:1 --> iv_cand:9, cost=3D(7,2) + group:2 --> iv_cand:3, cost=3D(0,0) + invariant variables: 5 + invariant expressions: 1, 4 + +Improved to: + cost: 26 (complexity 1) + reg_cost: 6 + cand_cost: 10 + cand_group_cost: 10 (complexity 1) + candidates: 3, 4 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:4, cost=3D(8,1) + group:2 --> iv_cand:3, cost=3D(0,0) + invariant variables: 5 + invariant expressions: 5 + +Improved to: + cost: 26 (complexity 0) + reg_cost: 7 + cand_cost: 16 + cand_group_cost: 3 (complexity 0) + candidates: 3, 4, 6 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:6, cost=3D(1,0) + group:2 --> iv_cand:3, cost=3D(0,0) + invariant variables: 5 + invariant expressions: + +Original cost 26 (complexity 0) + +Final cost 26 (complexity 0) + +Selected IV set for loop 3 at fp_foo.c:3, 10 avg niters, 3 IVs: +Candidate 3: + Var befor: i_56 + Var after: i_40 + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Var befor: ivtmp.23_85 + Var after: ivtmp.23_84 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + ((sizetype) _7 + 1) * 4) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.25_78 + Var after: ivtmp.25_77 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + ((sizetype) _11 + 1) * 4) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow + +;; +;; Loop 2 +;; header 7, latch 12 +;; depth 2, outer 1, finite_p +;; niter ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 +;; upper_bound 2147483645 +;; likely_upper_bound 2147483645 +;; iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 2992276 (estimated locally, freq 7.2009) +;; nodes: 7 12 9 8 13 +Processing loop 2 at fp_foo.c:9 + single exit 9 -> 17, exit condition if (n_23(D) > j_30) + + + +Loops in function: dgefa +loop_0 (header =3D 0, latch =3D 1) +{ + bb_2 (preds =3D {bb_0 }, succs =3D {bb_10 bb_14 }) + { + [local count: 1804255]: + _45 =3D n_23(D) + -1; + if (n_23(D) > 1) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_14 (preds =3D {bb_2 }, succs =3D {bb_3 }) + { + [local count: 198468]: + + } + bb_3 (preds =3D {bb_14 bb_16 }, succs =3D {bb_1 }) + { + [local count: 1804255]: + # .MEM_88 =3D PHI <.MEM_22(D)(14), .MEM_53(16)> + # VUSE <.MEM_88> + return; + + } + bb_10 (preds =3D {bb_2 }, succs =3D {bb_4 }) + { + [local count: 1605787]: + + } + bb_16 (preds =3D {bb_5 }, succs =3D {bb_3 }) + { + [local count: 1605787]: + # .MEM_53 =3D PHI <.MEM_89(5)> + goto ; [100.00%] + + } + loop_1 (header =3D 4, latch =3D 11, finite_p + niter (unsigned int) n_23(D) + 4294967294 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:160= 5787 (estimated locally, freq 0.8900)) + { + bb_4 (preds =3D {bb_11 bb_10 }, succs =3D {bb_6 bb_15 }) + { + [local count: 14598063]: + # i_50 =3D PHI + # .MEM_54 =3D PHI <.MEM_89(11), .MEM_22(D)(10)> + j_24 =3D i_50 + 1; + if (n_23(D) > j_24) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_15 (preds =3D {bb_4 }, succs =3D {bb_5 }) + { + [local count: 1605787]: + + } + bb_5 (preds =3D {bb_15 bb_17 }, succs =3D {bb_11 bb_16 }) + { + [local count: 14598063]: + # .MEM_89 =3D PHI <.MEM_54(15), .MEM_86(17)> + if (j_24 < _45) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_11 (preds =3D {bb_5 }, succs =3D {bb_4 }) + { + [local count: 12992276]: + goto ; [100.00%] + + } + bb_6 (preds =3D {bb_4 }, succs =3D {bb_7 }) + { + [local count: 12992276]: + _6 =3D m_25(D) * i_50; + _7 =3D _6 + i_50; + _8 =3D (sizetype) _7; + _9 =3D _8 + 1; + _10 =3D _9 * 4; + _87 =3D n_23(D) - j_24; + + } + bb_17 (preds =3D {bb_9 }, succs =3D {bb_5 }) + { + [local count: 12992276]: + # .MEM_86 =3D PHI <.MEM_55(9)> + goto ; [100.00%] + + } + loop_2 (header =3D 7, latch =3D 12, finite_p + niter ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 2992276 (estimated locally, freq 7.2009)) + { + bb_7 (preds =3D {bb_12 bb_6 }, succs =3D {bb_8 }) + { + [local count: 118111600]: + # j_51 =3D PHI + # .MEM_52 =3D PHI <.MEM_55(12), .MEM_54(6)> + _1 =3D m_25(D) * j_51; + _2 =3D _1 + l_26(D); + _3 =3D (long unsigned int) _2; + _4 =3D _3 * 4; + _5 =3D vector_27(D) + _4; + # VUSE <.MEM_52> + t_28 =3D *_5; + _11 =3D _1 + i_50; + _12 =3D (sizetype) _11; + _13 =3D _12 + 1; + _14 =3D _13 * 4; + _82 =3D (sizetype) _7; + _81 =3D _82 + 1; + _80 =3D _81 * 4; + _79 =3D vector_27(D) + _80; + ivtmp.23_83 =3D (unsigned long) _79; + _75 =3D (sizetype) _11; + _74 =3D _75 + 1; + _73 =3D _74 * 4; + _72 =3D vector_27(D) + _73; + ivtmp.25_76 =3D (unsigned long) _72; + + } + bb_9 (preds =3D {bb_8 }, succs =3D {bb_12 bb_17 }) + { + [local count: 118111600]: + # .MEM_55 =3D PHI <.MEM_42(8)> + j_30 =3D j_51 + 1; + if (n_23(D) > j_30) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_12 (preds =3D {bb_9 }, succs =3D {bb_7 }) + { + [local count: 105119324]: + goto ; [100.00%] + + } + loop_3 (header =3D 8, latch =3D 13, finite_p + niter _87 > 0 ? (unsigned int) _87 + 4294967295 : 0 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 7.090909 (unreliable, maybe flat) entry count= :118111600 (estimated locally, freq 65.4628)) + { + bb_8 (preds =3D {bb_13 bb_7 }, succs =3D {bb_13 bb_9 }) + { + [local count: 955630225]: + # i_56 =3D PHI + # .MEM_57 =3D PHI <.MEM_42(13), .MEM_52(7)> + # ivtmp.23_85 =3D PHI + # ivtmp.25_78 =3D PHI + _32 =3D (long unsigned int) i_56; + _33 =3D _32 * 4; + _21 =3D _10 + _33; + _34 =3D vector_27(D) + _21; + _71 =3D (void *) ivtmp.23_85; + # VUSE <.MEM_57> + _35 =3D MEM[(float *)_71]; + _29 =3D _14 + _33; + _36 =3D vector_27(D) + _29; + _69 =3D (void *) ivtmp.25_78; + # VUSE <.MEM_57> + _37 =3D MEM[(float *)_69]; + _38 =3D t_28 * _37; + _39 =3D _35 + _38; + _70 =3D (void *) ivtmp.23_85; + # .MEM_42 =3D VDEF <.MEM_57> + MEM[(float *)_70] =3D _39; + i_40 =3D i_56 + 1; + ivtmp.23_84 =3D ivtmp.23_85 + 4; + ivtmp.25_77 =3D ivtmp.25_78 + 4; + if (i_40 < _87) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_13 (preds =3D {bb_8 }, succs =3D {bb_8 }) + { + [local count: 850510901]: + goto ; [100.00%] + + } + } + } + } +} +Analyzing # of iterations of loop 2 + exit condition [i_50 + 2, + , 1](no_overflow) < n_23(D) + bounds on difference of bases: 0 ... 2147483645 + result: + # of iterations ((unsigned int) n_23(D) - (unsigned int) i_50) - 2, bo= unded by 2147483645 + number of iterations ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 + +: +IV struct: + SSA_NAME: _1 + Type: int + Base: (i_50 + 1) * m_25(D) + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _2 + Type: int + Base: (i_50 + 1) * m_25(D) + l_26(D) + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _3 + Type: long unsigned int + Base: (long unsigned int) ((i_50 + 1) * m_25(D)) + (long unsigned= int) l_26(D) + Step: (long unsigned int) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _4 + Type: long unsigned int + Base: ((long unsigned int) ((i_50 + 1) * m_25(D)) + (long unsigne= d int) l_26(D)) * 4 + Step: (long unsigned int) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _5 + Type: float * + Base: vector_27(D) + ((long unsigned int) ((i_50 + 1) * m_25(D)) = + (long unsigned int) l_26(D)) * 4 + Step: (long unsigned int) m_25(D) * 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _11 + Type: int + Base: (i_50 + 1) * m_25(D) + i_50 + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _12 + Type: sizetype + Base: (sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50 + Step: (sizetype) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _13 + Type: sizetype + Base: ((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1 + Step: (sizetype) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _14 + Type: sizetype + Base: (((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1)= * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: j_30 + Type: int + Base: i_50 + 2 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: j_51 + Type: int + Base: i_50 + 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _72 + Type: float * + Base: vector_27(D) + (((sizetype) ((i_50 + 1) * m_25(D)) + (sizet= ype) i_50) + 1) * 4 + Step: (sizetype) m_25(D) * 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _73 + Type: sizetype + Base: (((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1)= * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _74 + Type: sizetype + Base: ((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1 + Step: (sizetype) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _75 + Type: sizetype + Base: (sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50 + Step: (sizetype) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: ivtmp.25_76 + Type: unsigned long + Base: (unsigned long) (vector_27(D) + (((sizetype) ((i_50 + 1) * = m_25(D)) + (sizetype) i_50) + 1) * 4) + Step: (sizetype) m_25(D) * 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow + +: +Group 0: + Type: REFERENCE ADDRESS + Use 0.0: + At stmt: t_28 =3D *_5; + At pos: *_5 + IV struct: + Type: float * + Base: vector_27(D) + ((long unsigned int) ((i_50 + 1) * m_25(D)) = + (long unsigned int) l_26(D)) * 4 + Step: (long unsigned int) m_25(D) * 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 1: + Type: COMPARE + Use 1.0: + At stmt: if (n_23(D) > j_30) + At pos: j_30 + IV struct: + Type: int + Base: i_50 + 2 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 2: + Type: GENERIC + Use 2.0: + At stmt: ivtmp.25_76 =3D (unsigned long) _72; + At pos: + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + (((sizetype) ((i_50 + 1) * = m_25(D)) + (sizetype) i_50) + 1) * 4) + Step: (sizetype) m_25(D) * 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 3: + Type: GENERIC + Use 3.0: + At stmt: _14 =3D _13 * 4; + At pos: + IV struct: + Type: sizetype + Base: (((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1)= * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow + +Predict doloop failure due to target specific checks. +Candidate 0: + Var befor: ivtmp.29 + Var after: ivtmp.29 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 1: + Var befor: ivtmp.30 + Var after: ivtmp.30 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 2: + Var befor: ivtmp.31 + Var after: ivtmp.31 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: (sizetype) (i_50 + 2) + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Var befor: ivtmp.32 + Var after: ivtmp.32 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: (sizetype) (i_50 + 1) + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Incr POS: orig biv + IV struct: + Type: int + Base: i_50 + 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Depend on inv.exprs: 1 + Var befor: ivtmp.33 + Var after: ivtmp.33 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + ((long unsigned int) ((i_50= + 1) * m_25(D)) + (long unsigned int) l_26(D)) * 4) + Step: (unsigned long) ((long unsigned int) m_25(D) * 4) + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.34 + Var after: ivtmp.34 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) (i_50 + 2) + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 7: + Var befor: ivtmp.35 + Var after: ivtmp.35 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) i_50 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 8: + Depend on inv.exprs: 1 + Var befor: ivtmp.36 + Var after: ivtmp.36 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + (((sizetype) ((i_50 + 1) * = m_25(D)) + (sizetype) i_50) + 1) * 4) + Step: (sizetype) m_25(D) * 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 9: + Depend on inv.exprs: 1 + Var befor: ivtmp.37 + Var after: ivtmp.37 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (((sizetype) ((i_50 + 1) * m_25(D)) + (size= type) i_50) * 4) + (unsigned long) vector_27(D) + Step: (sizetype) m_25(D) * 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 10: + Depend on inv.exprs: 1 + Var befor: ivtmp.38 + Var after: ivtmp.38 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: (((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1)= * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 11: + Depend on inv.exprs: 1 + Var befor: ivtmp.39 + Var after: ivtmp.39 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: ((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 12: + Depend on inv.exprs: 1 + Var befor: ivtmp.40 + Var after: ivtmp.40 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 0 + Step: (long unsigned int) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow + +: 0, 1, 2, 3, 4, + + Related: + Group 0: 0, 1, 2, 3, 4, 5, 12 + Group 1: 0, 1, 2, 3, 4, 6, 7 + Group 2: 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 + Group 3: 0, 1, 2, 3, 4, 10, 11, 12 + +: + cand cost + 0 5 + 1 5 + 2 6 + 3 6 + 4 4 + 5 9 + 6 5 + 7 5 + 8 10 + 9 9 + 10 10 + 11 9 + 12 5 + + +: +Inv 6: _7 +Inv 8: _10 +Inv 7: n_23(D) (eliminable) +Inv 1: j_24 (eliminable) +Inv 2: m_25(D) (eliminable) +Inv 3: l_26(D) (eliminable) +Inv 4: vector_27(D) +Inv 5: i_50 (eliminable) +Inv 9: _87 + +: +inv_expr 1: (long unsigned int) m_25(D) * 4 +inv_expr 2: ((unsigned long) l_26(D) - (unsigned long) i_50) * 4 +inv_expr 3: (unsigned long) i_50 * 18446744073709551612 + (unsigned lon= g) l_26(D) * 4 +inv_expr 4: ((unsigned long) l_26(D) * 4 + (unsigned long) vector_27(D)= ) - (unsigned long) i_50 * 4 +inv_expr 5: ((unsigned long) ((i_50 + 1) * m_25(D)) + (unsigned long) l= _26(D)) * 4 + (unsigned long) vector_27(D) +inv_expr 6: ((unsigned int) n_23(D) - (unsigned int) i_50) + 4294967295 +inv_expr 7: (signed int) i_50 + 1 +inv_expr 8: (unsigned long) (((unsigned int) n_23(D) - (unsigned int) i= _50) + 4294967294) + 1 +inv_expr 9: ((sizetype) i_50 + (sizetype) (((unsigned int) n_23(D) - (u= nsigned int) i_50) + 4294967294)) + 3 +inv_expr 10: ((sizetype) i_50 + (sizetype) (((unsigned int) n_23(D) - (u= nsigned int) i_50) + 4294967294)) + 2 +inv_expr 11: (((signed long) i_50 - (signed long) l_26(D)) + 1) * 4 +inv_expr 12: (signed long) vector_27(D) + 4 +inv_expr 13: (((signed long) ((i_50 + 1) * m_25(D)) * 4 + (signed long) = vector_27(D)) + (signed long) i_50 * 4) + 4 +inv_expr 14: (((signed long) i_50 * 4 - (signed long) vector_27(D)) - (s= igned long) l_26(D) * 4) + 4 +inv_expr 15: 4 - (signed long) vector_27(D) +inv_expr 16: (((signed long) ((i_50 + 1) * m_25(D)) + (signed long) i_50= ) + 1) * 4 + +: +Group 0: + cand cost compl. inv.expr. inv.vars + 5 1 0 NIL; NIL; + 8 8 2 2; NIL; + 9 8 1 3; NIL; + 10 8 2 4; NIL; + 11 8 1 4; NIL; + 12 10 1 5; NIL; + +Group 1: + cand cost compl. inv.expr. inv.vars + 0 0 0 6; NIL; + 1 2 0 8; NIL; + 2 3 0 9; NIL; + 3 0 0 NIL; 7 + 4 0 0 NIL; 7 + 6 0 0 NIL; 7 + 7 0 0 NIL; 7 + +Group 2: + cand cost compl. inv.expr. inv.vars + 5 6 0 11; NIL; + 8 0 0 NIL; NIL; + 9 4 0 NIL; NIL; + 10 4 0 NIL; NIL; + 11 4 0 12; NIL; + 12 9 0 13; NIL; + +Group 3: + cand cost compl. inv.expr. inv.vars + 5 7 0 14; NIL; + 8 8 0 NIL; NIL; + 9 4 0 15; NIL; + 10 0 0 NIL; NIL; + 11 4 0 NIL; NIL; + 12 9 0 16; NIL; + + +: + target_avail_regs 26 + target_clobbered_regs 16 + target_reg_cost 4 + target_spill_cost 24 + regs_used 4 + cost for size: + ivs cost + 0 0 + 1 2 + 2 4 + 3 6 + 4 8 + 5 10 + 6 12 + 7 14 + 8 16 + 9 18 + 10 20 + 11 22 + 12 24 + 13 26 + 14 28 + 15 30 + 16 32 + 17 34 + 18 36 + 19 111 + 20 116 + 21 121 + 22 126 + 23 151 + 24 176 + 25 201 + 26 226 + 27 275 + 28 324 + 29 373 + 30 422 + 31 471 + 32 520 + 33 569 + 34 618 + 35 667 + 36 716 + 37 765 + 38 814 + 39 863 + 40 912 + 41 961 + 42 1010 + 43 1059 + 44 1108 + 45 1157 + 46 1206 + 47 1255 + 48 1304 + 49 1353 + 50 1402 + 51 1451 + 52 1500 + +Initial set of candidates: + cost: 35 (complexity 0) + reg_cost: 8 + cand_cost: 13 + cand_group_cost: 14 (complexity 0) + candidates: 4, 5 + group:0 --> iv_cand:5, cost=3D(1,0) + group:1 --> iv_cand:4, cost=3D(0,0) + group:2 --> iv_cand:5, cost=3D(6,0) + group:3 --> iv_cand:5, cost=3D(7,0) + invariant variables: 7 + invariant expressions: 1, 11, 14 + +Improved to: + cost: 33 (complexity 2) + reg_cost: 7 + cand_cost: 14 + cand_group_cost: 12 (complexity 2) + candidates: 4, 10 + group:0 --> iv_cand:10, cost=3D(8,2) + group:1 --> iv_cand:4, cost=3D(0,0) + group:2 --> iv_cand:10, cost=3D(4,0) + group:3 --> iv_cand:10, cost=3D(0,0) + invariant variables: 7 + invariant expressions: 1, 4 + +Initial set of candidates: + cost: 33 (complexity 2) + reg_cost: 7 + cand_cost: 14 + cand_group_cost: 12 (complexity 2) + candidates: 4, 10 + group:0 --> iv_cand:10, cost=3D(8,2) + group:1 --> iv_cand:4, cost=3D(0,0) + group:2 --> iv_cand:10, cost=3D(4,0) + group:3 --> iv_cand:10, cost=3D(0,0) + invariant variables: 7 + invariant expressions: 1, 4 + +Original cost 33 (complexity 2) + +Final cost 33 (complexity 2) + +Selected IV set for loop 2 at fp_foo.c:9, 10 avg niters, 2 IVs: +Candidate 4: + Var befor: j_51 + Var after: j_30 + Incr POS: orig biv + IV struct: + Type: int + Base: i_50 + 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 10: + Depend on inv.exprs: 1 + Var befor: ivtmp.38_68 + Var after: ivtmp.38_67 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: (((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1)= * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow + +Replacing exit test: if (n_23(D) > j_30) +;; +;; Loop 1 +;; header 4, latch 11 +;; depth 1, outer 0, finite_p +;; niter (unsigned int) n_23(D) + 4294967294 +;; upper_bound 2147483645 +;; likely_upper_bound 2147483645 +;; iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 605787 (estimated locally, freq 0.8900) +;; nodes: 4 11 5 15 17 9 8 13 7 12 6 +Processing loop 1 at fp_foo.c:8 + single exit 5 -> 16, exit condition if (j_24 < _45) + + + +Loops in function: dgefa +loop_0 (header =3D 0, latch =3D 1) +{ + bb_2 (preds =3D {bb_0 }, succs =3D {bb_10 bb_14 }) + { + [local count: 1804255]: + _45 =3D n_23(D) + -1; + if (n_23(D) > 1) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_14 (preds =3D {bb_2 }, succs =3D {bb_3 }) + { + [local count: 198468]: + + } + bb_3 (preds =3D {bb_14 bb_16 }, succs =3D {bb_1 }) + { + [local count: 1804255]: + # .MEM_88 =3D PHI <.MEM_22(D)(14), .MEM_53(16)> + # VUSE <.MEM_88> + return; + + } + bb_10 (preds =3D {bb_2 }, succs =3D {bb_4 }) + { + [local count: 1605787]: + + } + bb_16 (preds =3D {bb_5 }, succs =3D {bb_3 }) + { + [local count: 1605787]: + # .MEM_53 =3D PHI <.MEM_89(5)> + goto ; [100.00%] + + } + loop_1 (header =3D 4, latch =3D 11, finite_p + niter (unsigned int) n_23(D) + 4294967294 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:160= 5787 (estimated locally, freq 0.8900)) + { + bb_4 (preds =3D {bb_11 bb_10 }, succs =3D {bb_6 bb_15 }) + { + [local count: 14598063]: + # i_50 =3D PHI + # .MEM_54 =3D PHI <.MEM_89(11), .MEM_22(D)(10)> + j_24 =3D i_50 + 1; + if (n_23(D) > j_24) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_15 (preds =3D {bb_4 }, succs =3D {bb_5 }) + { + [local count: 1605787]: + + } + bb_5 (preds =3D {bb_15 bb_17 }, succs =3D {bb_11 bb_16 }) + { + [local count: 14598063]: + # .MEM_89 =3D PHI <.MEM_54(15), .MEM_86(17)> + if (j_24 < _45) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_11 (preds =3D {bb_5 }, succs =3D {bb_4 }) + { + [local count: 12992276]: + goto ; [100.00%] + + } + bb_6 (preds =3D {bb_4 }, succs =3D {bb_7 }) + { + [local count: 12992276]: + _6 =3D m_25(D) * i_50; + _7 =3D _6 + i_50; + _8 =3D (sizetype) _7; + _9 =3D _8 + 1; + _10 =3D _9 * 4; + _87 =3D n_23(D) - j_24; + _66 =3D (sizetype) m_25(D); + _65 =3D _66 * 4; + _63 =3D i_50 + 1; + _62 =3D m_25(D) * _63; + _61 =3D (sizetype) _62; + _60 =3D (sizetype) i_50; + _59 =3D _60 + _61; + _58 =3D _59 + 1; + ivtmp.38_64 =3D _58 * 4; + + } + bb_17 (preds =3D {bb_9 }, succs =3D {bb_5 }) + { + [local count: 12992276]: + # .MEM_86 =3D PHI <.MEM_55(9)> + goto ; [100.00%] + + } + loop_2 (header =3D 7, latch =3D 12, finite_p + niter ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 2992276 (estimated locally, freq 7.2009)) + { + bb_7 (preds =3D {bb_12 bb_6 }, succs =3D {bb_8 }) + { + [local count: 118111600]: + # j_51 =3D PHI + # .MEM_52 =3D PHI <.MEM_55(12), .MEM_54(6)> + # ivtmp.38_68 =3D PHI + _1 =3D m_25(D) * j_51; + _2 =3D _1 + l_26(D); + _3 =3D (long unsigned int) _2; + _4 =3D _3 * 4; + _5 =3D vector_27(D) + _4; + _49 =3D (sizetype) i_50; + _48 =3D _49 * 18446744073709551612; + _47 =3D (sizetype) l_26(D); + _46 =3D _47 * 4; + _44 =3D _46 + _48; + _43 =3D vector_27(D) + _44; + _41 =3D _43 + 18446744073709551612; + _31 =3D _43 + ivtmp.38_68; + # VUSE <.MEM_52> + t_28 =3D MEM[(float *)_31 + -4B]; + _11 =3D _1 + i_50; + _12 =3D (sizetype) _11; + _13 =3D _12 + 1; + _14 =3D ivtmp.38_68; + _82 =3D (sizetype) _7; + _81 =3D _82 + 1; + _80 =3D _81 * 4; + _79 =3D vector_27(D) + _80; + ivtmp.23_83 =3D (unsigned long) _79; + _75 =3D (sizetype) _11; + _74 =3D _75 + 1; + _73 =3D _74 * 4; + _72 =3D vector_27(D) + _73; + _20 =3D (unsigned long) vector_27(D); + _19 =3D _20 + ivtmp.38_68; + ivtmp.25_76 =3D _19; + + } + bb_9 (preds =3D {bb_8 }, succs =3D {bb_12 bb_17 }) + { + [local count: 118111600]: + # .MEM_55 =3D PHI <.MEM_42(8)> + j_30 =3D j_51 + 1; + ivtmp.38_67 =3D ivtmp.38_68 + _65; + if (j_30 !=3D n_23(D)) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_12 (preds =3D {bb_9 }, succs =3D {bb_7 }) + { + [local count: 105119324]: + goto ; [100.00%] + + } + loop_3 (header =3D 8, latch =3D 13, finite_p + niter _87 > 0 ? (unsigned int) _87 + 4294967295 : 0 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 7.090909 (unreliable, maybe flat) entry count= :118111600 (estimated locally, freq 65.4628)) + { + bb_8 (preds =3D {bb_13 bb_7 }, succs =3D {bb_13 bb_9 }) + { + [local count: 955630225]: + # i_56 =3D PHI + # .MEM_57 =3D PHI <.MEM_42(13), .MEM_52(7)> + # ivtmp.23_85 =3D PHI + # ivtmp.25_78 =3D PHI + _32 =3D (long unsigned int) i_56; + _33 =3D _32 * 4; + _21 =3D _10 + _33; + _34 =3D vector_27(D) + _21; + _71 =3D (void *) ivtmp.23_85; + # VUSE <.MEM_57> + _35 =3D MEM[(float *)_71]; + _29 =3D _14 + _33; + _36 =3D vector_27(D) + _29; + _69 =3D (void *) ivtmp.25_78; + # VUSE <.MEM_57> + _37 =3D MEM[(float *)_69]; + _38 =3D t_28 * _37; + _39 =3D _35 + _38; + _70 =3D (void *) ivtmp.23_85; + # .MEM_42 =3D VDEF <.MEM_57> + MEM[(float *)_70] =3D _39; + i_40 =3D i_56 + 1; + ivtmp.23_84 =3D ivtmp.23_85 + 4; + ivtmp.25_77 =3D ivtmp.25_78 + 4; + if (i_40 < _87) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_13 (preds =3D {bb_8 }, succs =3D {bb_8 }) + { + [local count: 850510901]: + goto ; [100.00%] + + } + } + } + } +} +Analyzing # of iterations of loop 1 + exit condition [1, + , 1](no_overflow) < n_23(D) + -1 + bounds on difference of bases: 0 ... 2147483645 + result: + # of iterations (unsigned int) n_23(D) + 4294967294, bounded by 214748= 3645 + number of iterations (unsigned int) n_23(D) + 4294967294 + +: +IV struct: + SSA_NAME: _6 + Type: int + Base: 0 + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _7 + Type: int + Base: 0 + Step: (int) ((unsigned int) m_25(D) + 1) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: j_24 + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _41 + Type: float * + Base: vector_27(D) + ((sizetype) l_26(D) * 4 + 184467440737095516= 12) + Step: 18446744073709551612 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _43 + Type: float * + Base: vector_27(D) + (sizetype) l_26(D) * 4 + Step: 18446744073709551612 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _44 + Type: sizetype + Base: (sizetype) l_26(D) * 4 + Step: 18446744073709551612 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _48 + Type: sizetype + Base: 0 + Step: 18446744073709551612 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _49 + Type: sizetype + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: i_50 + Type: int + Base: 0 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _60 + Type: sizetype + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _62 + Type: int + Base: m_25(D) + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _63 + Type: int + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _87 + Type: int + Base: n_23(D) + -1 + Step: -1 + Biv: N + Overflowness wrto loop niter: Overflow + +: +Group 0: + Type: COMPARE + Use 0.0: + At stmt: if (n_23(D) > j_24) + At pos: j_24 + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 1: + Type: COMPARE + Use 1.0: + At stmt: if (j_24 < _45) + At pos: j_24 + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 2: + Type: COMPARE + Use 2.0: + At stmt: if (i_40 < _87) + At pos: _87 + IV struct: + Type: int + Base: n_23(D) + -1 + Step: -1 + Biv: N + Overflowness wrto loop niter: Overflow +Group 3: + Type: GENERIC + Use 3.0: + At stmt: j_24 =3D i_50 + 1; + At pos: + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 4: + Type: GENERIC + Use 4.0: + At stmt: _43 =3D vector_27(D) + _44; + At pos: + IV struct: + Type: float * + Base: vector_27(D) + (sizetype) l_26(D) * 4 + Step: 18446744073709551612 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +Group 5: + Type: GENERIC + Use 5.0: + At stmt: i_50 =3D PHI + At pos: + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 6: + Type: GENERIC + Use 6.0: + At stmt: _7 =3D _6 + i_50; + At pos: + IV struct: + Type: int + Base: 0 + Step: (int) ((unsigned int) m_25(D) + 1) + Biv: N + Overflowness wrto loop niter: Overflow +Group 7: + Type: GENERIC + Use 7.0: + At stmt: _62 =3D m_25(D) * _63; + At pos: + IV struct: + Type: int + Base: m_25(D) + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 8: + Type: GENERIC + Use 8.0: + At stmt: _60 =3D (sizetype) i_50; + At pos: + IV struct: + Type: sizetype + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow + +Predict doloop failure due to target specific checks. +Candidate 0: + Var befor: ivtmp.41 + Var after: ivtmp.41 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 1: + Var befor: ivtmp.42 + Var after: ivtmp.42 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 2: + Var befor: ivtmp.43 + Var after: ivtmp.43 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Var befor: ivtmp.44 + Var after: ivtmp.44 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) (n_23(D) + -1) + Step: 4294967295 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Var befor: ivtmp.45 + Var after: ivtmp.45 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) n_23(D) + Step: 4294967295 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.46 + Var after: ivtmp.46 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + (sizetype) l_26(D) * 4) + Step: 18446744073709551612 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 7: + Depend on inv.exprs: 1 + Var befor: ivtmp.47 + Var after: ivtmp.47 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: (unsigned int) m_25(D) + 1 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 8: + Var befor: ivtmp.48 + Var after: ivtmp.48 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) m_25(D) + Step: (unsigned int) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow + +: 0, 1, 2, 3, + + Related: + Group 0: 0, 1, 2, 3 + Group 1: 0, 1, 2, 3 + Group 2: 0, 1, 2, 3, 4, 5 + Group 3: 0, 1, 2, 3 + Group 4: 0, 1, 2, 3, 6 + Group 5: 0, 1, 2, 3 + Group 6: 0, 1, 2, 3, 7 + Group 7: 0, 1, 2, 3, 8 + Group 8: 0, 1, 2, 3 + +: + cand cost + 0 5 + 1 5 + 2 5 + 3 4 + 4 5 + 5 5 + 6 6 + 7 5 + 8 5 + +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 20.00: 0 (scratch: 0) -> 0 +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 2.00: 9 (scratch: 1) -> 17 +Scaling cost based on bb prob by 2.00: 0 (scratch: 0) -> 0 + +: +Inv 1: n_23(D) +Inv 4: m_25(D) +Inv 5: l_26(D) +Inv 3: vector_27(D) +Inv 2: _45 (eliminable) + +: +inv_expr 1: (unsigned int) m_25(D) + 1 +inv_expr 2: (signed int) n_23(D) + 1 +inv_expr 3: (signed int) n_23(D) + -1 +inv_expr 4: (signed long) l_26(D) * 4 + (signed long) vector_27(D) + +: +Group 0: + cand cost compl. inv.expr. inv.vars + 0 4 0 NIL; NIL; + 1 4 0 NIL; NIL; + 2 0 0 NIL; NIL; + 3 0 0 NIL; NIL; + 4 4 0 NIL; NIL; + 5 4 0 2; NIL; + +Group 1: + cand cost compl. inv.expr. inv.vars + 0 0 0 NIL; NIL; + 1 0 0 NIL; 2 + 2 0 0 NIL; NIL; + 3 0 0 NIL; NIL; + 4 0 0 NIL; NIL; + 5 0 0 NIL; NIL; + 6 3 0 NIL; NIL; + +Group 2: + cand cost compl. inv.expr. inv.vars + 0 80 0 3; NIL; + 1 80 0 3; NIL; + 2 80 0 NIL; NIL; + 3 80 0 NIL; NIL; + 4 0 0 NIL; NIL; + 5 80 0 NIL; NIL; + +Group 3: + cand cost compl. inv.expr. inv.vars + 0 4 0 NIL; NIL; + 1 4 0 NIL; NIL; + 2 0 0 NIL; NIL; + 3 0 0 NIL; NIL; + 4 4 0 NIL; NIL; + 5 4 0 2; NIL; + +Group 4: + cand cost compl. inv.expr. inv.vars + 1 17 0 4; NIL; + 6 0 0 NIL; NIL; + +Group 5: + cand cost compl. inv.expr. inv.vars + 0 0 0 NIL; NIL; + 1 0 0 NIL; NIL; + 2 4 0 NIL; NIL; + 3 0 0 NIL; NIL; + 4 4 0 3; NIL; + 5 4 0 NIL; NIL; + +Group 6: + cand cost compl. inv.expr. inv.vars + 7 0 0 NIL; NIL; + +Group 7: + cand cost compl. inv.expr. inv.vars + 8 0 0 NIL; NIL; + +Group 8: + cand cost compl. inv.expr. inv.vars + 1 0 0 NIL; NIL; + + +: + target_avail_regs 26 + target_clobbered_regs 16 + target_reg_cost 4 + target_spill_cost 24 + regs_used 4 + cost for size: + ivs cost + 0 0 + 1 2 + 2 4 + 3 6 + 4 8 + 5 10 + 6 12 + 7 14 + 8 16 + 9 18 + 10 20 + 11 22 + 12 24 + 13 26 + 14 28 + 15 30 + 16 32 + 17 34 + 18 36 + 19 111 + 20 116 + 21 121 + 22 126 + 23 151 + 24 176 + 25 201 + 26 226 + 27 275 + 28 324 + 29 373 + 30 422 + 31 471 + 32 520 + 33 569 + 34 618 + 35 667 + 36 716 + 37 765 + 38 814 + 39 863 + 40 912 + 41 961 + 42 1010 + 43 1059 + 44 1108 + 45 1157 + 46 1206 + 47 1255 + 48 1304 + 49 1353 + 50 1402 + 51 1451 + 52 1500 + +Initial set of candidates: + cost: 126 (complexity 0) + reg_cost: 10 + cand_cost: 19 + cand_group_cost: 97 (complexity 0) + candidates: 1, 3, 7, 8 + group:0 --> iv_cand:3, cost=3D(0,0) + group:1 --> iv_cand:3, cost=3D(0,0) + group:2 --> iv_cand:3, cost=3D(80,0) + group:3 --> iv_cand:3, cost=3D(0,0) + group:4 --> iv_cand:1, cost=3D(17,0) + group:5 --> iv_cand:3, cost=3D(0,0) + group:6 --> iv_cand:7, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1, 4 + +Improved to: + cost: 53 (complexity 0) + reg_cost: 12 + cand_cost: 24 + cand_group_cost: 17 (complexity 0) + candidates: 1, 3, 4, 7, 8 + group:0 --> iv_cand:3, cost=3D(0,0) + group:1 --> iv_cand:3, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:3, cost=3D(0,0) + group:4 --> iv_cand:1, cost=3D(17,0) + group:5 --> iv_cand:3, cost=3D(0,0) + group:6 --> iv_cand:7, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1, 4 + +Improved to: + cost: 43 (complexity 0) + reg_cost: 13 + cand_cost: 30 + cand_group_cost: 0 (complexity 0) + candidates: 1, 3, 4, 6, 7, 8 + group:0 --> iv_cand:3, cost=3D(0,0) + group:1 --> iv_cand:3, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:3, cost=3D(0,0) + group:4 --> iv_cand:6, cost=3D(0,0) + group:5 --> iv_cand:3, cost=3D(0,0) + group:6 --> iv_cand:7, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1 + +Initial set of candidates: + cost: 55 (complexity 0) + reg_cost: 10 + cand_cost: 20 + cand_group_cost: 25 (complexity 0) + candidates: 1, 4, 7, 8 + group:0 --> iv_cand:4, cost=3D(4,0) + group:1 --> iv_cand:4, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:4, cost=3D(4,0) + group:4 --> iv_cand:1, cost=3D(17,0) + group:5 --> iv_cand:1, cost=3D(0,0) + group:6 --> iv_cand:7, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1, 4 + +Improved to: + cost: 45 (complexity 0) + reg_cost: 11 + cand_cost: 26 + cand_group_cost: 8 (complexity 0) + candidates: 1, 4, 6, 7, 8 + group:0 --> iv_cand:4, cost=3D(4,0) + group:1 --> iv_cand:4, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:4, cost=3D(4,0) + group:4 --> iv_cand:6, cost=3D(0,0) + group:5 --> iv_cand:1, cost=3D(0,0) + group:6 --> iv_cand:7, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1 + +Improved to: + cost: 43 (complexity 0) + reg_cost: 13 + cand_cost: 30 + cand_group_cost: 0 (complexity 0) + candidates: 1, 3, 4, 6, 7, 8 + group:0 --> iv_cand:3, cost=3D(0,0) + group:1 --> iv_cand:3, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:3, cost=3D(0,0) + group:4 --> iv_cand:6, cost=3D(0,0) + group:5 --> iv_cand:3, cost=3D(0,0) + group:6 --> iv_cand:7, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1 + +Original cost 43 (complexity 0) + +Final cost 43 (complexity 0) + +Selected IV set for loop 1 at fp_foo.c:8, 10 avg niters, 6 IVs: +Candidate 1: + Var befor: ivtmp.42_18 + Var after: ivtmp.42_17 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Var befor: i_50 + Var after: j_24 + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Var befor: ivtmp.44_16 + Var after: ivtmp.44_15 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) (n_23(D) + -1) + Step: 4294967295 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.46_92 + Var after: ivtmp.46_93 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + (sizetype) l_26(D) * 4) + Step: 18446744073709551612 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 7: + Depend on inv.exprs: 1 + Var befor: ivtmp.47_98 + Var after: ivtmp.47_99 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: (unsigned int) m_25(D) + 1 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 8: + Var befor: ivtmp.48_102 + Var after: ivtmp.48_103 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) m_25(D) + Step: (unsigned int) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow + +Replacing exit test: if (j_24 < _45) diff --git a/gcc/testsuite/before.s b/gcc/testsuite/before.s new file mode 100644 index 00000000000..e13834bdf59 --- /dev/null +++ b/gcc/testsuite/before.s @@ -0,0 +1,152 @@ + .file 1 "fp_foo.c" + .section .mdebug.abi64 + .previous + .nan 2008 + .module fp=3D64 + .module oddspreg + .module arch=3Dmips64r6 + .abicalls + .text + .align 2 + .align 3 + .globl daxpy + .set nomips16 + .set nomicromips + .ent daxpy + .type daxpy, @function +daxpy: + .frame $sp,0,$31 # vars=3D 0, regs=3D 0/0, args=3D 0= , gp=3D 0 + .mask 0x00000000,0 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + blezc $6,.L7 + dlsa $6,$6,$4,2 + .align 3 +.L3: + lwc1 $f1,0($5) + daddiu $4,$4,4 + lwc1 $f0,-4($4) + daddiu $5,$5,4 + maddf.s $f0,$f1,$f15 + bne $4,$6,.L3 + swc1 $f0,-4($4) + +.L7: + jrc $31 + .set macro + .set reorder + .end daxpy + .size daxpy, .-daxpy + .align 2 + .align 3 + .globl dgefa + .set nomips16 + .set nomicromips + .ent dgefa + .type dgefa, @function +dgefa: + .frame $sp,48,$31 # vars=3D 0, regs=3D 6/0, args=3D 0= , gp=3D 0 + .mask 0x101f0000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + li $2,1 # 0x1 + bgec $2,$6,.L23 + daddiu $sp,$sp,-48 + addiu $14,$6,-1 + move $11,$6 + sd $20,32($sp) + sd $19,24($sp) + addiu $20,$5,1 + sd $18,16($sp) + move $18,$4 + sd $17,8($sp) + dlsa $10,$7,$4,2 + sd $16,0($sp) + move $17,$5 + dsll $12,$5,2 + move $25,$5 + move $13,$0 + move $24,$0 + move $15,$0 + move $19,$14 + .align 3 +.L11: + addiu $8,$15,1 + addiu $16,$15,1 + move $15,$8 + bgec $8,$11,.L15 + daddu $5,$25,$24 + daddiu $9,$13,1 + dsubu $6,$0,$13 + dsll $5,$5,2 + dlsa $9,$9,$18,2 + dsll $6,$6,2 + move $7,$14 + .align 3 +.L14: + daddu $3,$10,$5 + move $2,$9 + lwc1 $f2,0($3) + move $4,$0 + .align 3 +.L13: + daddu $3,$6,$2 + lwc1 $f0,0($2) + daddu $3,$3,$5 + daddiu $2,$2,4 + lwc1 $f1,0($3) + addiu $4,$4,1 + maddf.s $f0,$f2,$f1 + swc1 $f0,-4($2) + bltc $4,$7,.L13 + addiu $8,$8,1 + bne $11,$8,.L14 + daddu $5,$5,$12 + +.L15: + daddiu $24,$24,1 + addu $13,$20,$13 + addiu $14,$14,-1 + daddiu $10,$10,-4 + bne $19,$16,.L11 + addu $25,$17,$25 + + ld $20,32($sp) + ld $19,24($sp) + ld $18,16($sp) + ld $17,8($sp) + ld $16,0($sp) + jr $31 + daddiu $sp,$sp,48 + +.L23: + jrc $31 + .set macro + .set reorder + .end dgefa + .size dgefa, .-dgefa + .section .text.startup,"ax",@progbits + .align 2 + .align 3 + .globl main + .set nomips16 + .set nomicromips + .ent main + .type main, @function +main: + .frame $sp,0,$31 # vars=3D 0, regs=3D 0/0, args=3D 0= , gp=3D 0 + .mask 0x00000000,0 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + jr $31 + move $2,$0 + + .set macro + .set reorder + .end main + .size main, .-main + .ident "GCC: (GNU) 14.0.1 20240214 (experimental)" + .section .note.GNU-stack,"",@progbits diff --git a/gcc/testsuite/before.txt b/gcc/testsuite/before.txt new file mode 100644 index 00000000000..c87764b8ae9 --- /dev/null +++ b/gcc/testsuite/before.txt @@ -0,0 +1,2694 @@ +tree_ssa_iv_optimize +;; +;; Loop 1 +;; header 3, latch 6 +;; depth 1, outer 0, finite_p +;; niter (unsigned int) n_12(D) + 4294967295 +;; upper_bound 2147483646 +;; likely_upper_bound 2147483646 +;; iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 05119324 (estimated locally, freq 0.8900) +;; nodes: 3 6 +Processing loop 1 at fp_foo.c:3 + single exit 3 -> 7, exit condition if (n_12(D) > i_17) + + + +Loops in function: daxpy +loop_0 (header =3D 0, latch =3D 1) +{ + bb_2 (preds =3D {bb_0 }, succs =3D {bb_5 bb_4 }) + { + [local count: 118111600]: + if (n_12(D) > 0) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_5 (preds =3D {bb_2 }, succs =3D {bb_3 }) + { + [local count: 105119324]: + + } + bb_7 (preds =3D {bb_3 }, succs =3D {bb_4 }) + { + [local count: 105119324]: + # .MEM_22 =3D PHI <.MEM_16(3)> + + } + bb_4 (preds =3D {bb_2 bb_7 }, succs =3D {bb_1 }) + { + [local count: 118111600]: + # .MEM_29 =3D PHI <.MEM_11(D)(2), .MEM_22(7)> + # VUSE <.MEM_29> + return; + + } + loop_1 (header =3D 3, latch =3D 6, finite_p + niter (unsigned int) n_12(D) + 4294967295 + upper_bound 2147483646 + likely_upper_bound 2147483646 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:105= 119324 (estimated locally, freq 0.8900)) + { + bb_3 (preds =3D {bb_6 bb_5 }, succs =3D {bb_6 bb_7 }) + { + [local count: 955630224]: + # i_20 =3D PHI + # .MEM_21 =3D PHI <.MEM_16(6), .MEM_11(D)(5)> + _1 =3D (long unsigned int) i_20; + _2 =3D _1 * 4; + _3 =3D vector1_13(D) + _2; + # VUSE <.MEM_21> + _4 =3D *_3; + _5 =3D vector2_14(D) + _2; + # VUSE <.MEM_21> + _6 =3D *_5; + _7 =3D _6 * fp_const_15(D); + _8 =3D _4 + _7; + # .MEM_16 =3D VDEF <.MEM_21> + *_3 =3D _8; + i_17 =3D i_20 + 1; + if (n_12(D) > i_17) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_6 (preds =3D {bb_3 }, succs =3D {bb_3 }) + { + [local count: 850510900]: + goto ; [100.00%] + + } + } +} +Analyzing # of iterations of loop 1 + exit condition [1, + , 1](no_overflow) < n_12(D) + bounds on difference of bases: 0 ... 2147483646 + result: + # of iterations (unsigned int) n_12(D) + 4294967295, bounded by 214748= 3646 + number of iterations (unsigned int) n_12(D) + 4294967295 + +: +IV struct: + SSA_NAME: _1 + Type: long unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _2 + Type: long unsigned int + Base: 0 + Step: 4 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _3 + Type: float * + Base: vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _5 + Type: float * + Base: vector2_14(D) + Step: 4 + Object: (void *) vector2_14(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: i_17 + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: i_20 + Type: int + Base: 0 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow + +: +Group 0: + Type: REFERENCE ADDRESS + Use 0.0: + At stmt: _4 =3D *_3; + At pos: *_3 + IV struct: + Type: float * + Base: vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: Overflow + Use 0.1: + At stmt: *_3 =3D _8; + At pos: *_3 + IV struct: + Type: float * + Base: vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 1: + Type: REFERENCE ADDRESS + Use 1.0: + At stmt: _6 =3D *_5; + At pos: *_5 + IV struct: + Type: float * + Base: vector2_14(D) + Step: 4 + Object: (void *) vector2_14(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 2: + Type: COMPARE + Use 2.0: + At stmt: if (n_12(D) > i_17) + At pos: i_17 + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow + +Predict doloop failure due to target specific checks. +Candidate 0: + Var befor: ivtmp.6 + Var after: ivtmp.6 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 1: + Var befor: ivtmp.7 + Var after: ivtmp.7 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 2: + Var befor: ivtmp.8 + Var after: ivtmp.8 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Var befor: ivtmp.9 + Var after: ivtmp.9 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Var befor: ivtmp.10 + Var after: ivtmp.10 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) vector2_14(D) + Step: 4 + Object: (void *) vector2_14(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.11 + Var after: ivtmp.11 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 7: + Var befor: ivtmp.12 + Var after: ivtmp.12 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 0 + Step: 4 + Biv: N + Overflowness wrto loop niter: No-overflow + +: 0, 1, 2, 3, + + Related: + Group 0: 0, 1, 2, 3, 4, 7 + Group 1: 0, 1, 2, 3, 5, 7 + Group 2: 0, 1, 2, 3, 6 + +: + cand cost +force_expr_to_var_cost size costs: + integer 0 + symbol 5 + address 5 + other 24 + +force_expr_to_var_cost speed costs: + integer 0 + symbol 5 + address 5 + other 24 + + 0 5 + 1 5 + 2 5 + 3 4 + 4 5 + 5 5 + 6 5 + 7 5 + + +: +Inv 4: n_12(D) (eliminable) +Inv 1: vector1_13(D) (eliminable) +Inv 2: vector2_14(D) (eliminable) +Inv 3: fp_const_15(D) (eliminable) + +: +inv_expr 1: (unsigned long) vector1_13(D) + 18446744073709551612 +inv_expr 2: (unsigned long) vector2_14(D) + 18446744073709551612 +inv_expr 3: (unsigned long) n_12(D) * 4 + (unsigned long) vector1_13(D) +inv_expr 4: (unsigned long) n_12(D) * 4 + (unsigned long) vector2_14(D) + +: +Group 0: + cand cost compl. inv.expr. inv.vars + 1 18 0 NIL; 1 + 2 20 0 1; NIL; + 4 2 0 NIL; NIL; + 7 10 0 NIL; 1 + +Group 1: + cand cost compl. inv.expr. inv.vars + 1 9 0 NIL; 2 + 2 10 0 2; NIL; + 5 1 0 NIL; NIL; + 7 5 0 NIL; 2 + +Group 2: + cand cost compl. inv.expr. inv.vars + 0 0 0 NIL; 4 + 1 0 0 NIL; 4 + 2 1 0 NIL; 4 + 3 0 0 NIL; 4 + 4 1 0 3; NIL; + 5 1 0 4; NIL; + 6 0 0 NIL; 4 + 7 1 0 NIL; 4 + + +: + target_avail_regs 26 + target_clobbered_regs 16 + target_reg_cost 4 + target_spill_cost 24 + regs_used 0 + cost for size: + ivs cost + 0 0 + 1 2 + 2 4 + 3 6 + 4 8 + 5 10 + 6 12 + 7 14 + 8 16 + 9 18 + 10 20 + 11 22 + 12 24 + 13 26 + 14 28 + 15 30 + 16 32 + 17 34 + 18 36 + 19 38 + 20 40 + 21 42 + 22 44 + 23 115 + 24 120 + 25 125 + 26 130 + 27 179 + 28 228 + 29 277 + 30 326 + 31 375 + 32 424 + 33 473 + 34 522 + 35 571 + 36 620 + 37 669 + 38 718 + 39 767 + 40 816 + 41 865 + 42 914 + 43 963 + 44 1012 + 45 1061 + 46 1110 + 47 1159 + 48 1208 + 49 1257 + 50 1306 + 51 1355 + 52 1404 + +Initial set of candidates: + cost: 37 (complexity 0) + reg_cost: 5 + cand_cost: 5 + cand_group_cost: 27 (complexity 0) + candidates: 1 + group:0 --> iv_cand:1, cost=3D(18,0) + group:1 --> iv_cand:1, cost=3D(9,0) + group:2 --> iv_cand:1, cost=3D(0,0) + invariant variables: 1, 2, 4 + invariant expressions: + +Improved to: + cost: 26 (complexity 0) + reg_cost: 5 + cand_cost: 5 + cand_group_cost: 16 (complexity 0) + candidates: 7 + group:0 --> iv_cand:7, cost=3D(10,0) + group:1 --> iv_cand:7, cost=3D(5,0) + group:2 --> iv_cand:7, cost=3D(1,0) + invariant variables: 1, 2, 4 + invariant expressions: + +Improved to: + cost: 24 (complexity 0) + reg_cost: 6 + cand_cost: 10 + cand_group_cost: 8 (complexity 0) + candidates: 4, 7 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:7, cost=3D(5,0) + group:2 --> iv_cand:7, cost=3D(1,0) + invariant variables: 2, 4 + invariant expressions: + +Improved to: + cost: 19 (complexity 0) + reg_cost: 5 + cand_cost: 10 + cand_group_cost: 4 (complexity 0) + candidates: 4, 5 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:5, cost=3D(1,0) + group:2 --> iv_cand:4, cost=3D(1,0) + invariant variables: + invariant expressions: 3 + +Initial set of candidates: + cost: 26 (complexity 0) + reg_cost: 5 + cand_cost: 5 + cand_group_cost: 16 (complexity 0) + candidates: 7 + group:0 --> iv_cand:7, cost=3D(10,0) + group:1 --> iv_cand:7, cost=3D(5,0) + group:2 --> iv_cand:7, cost=3D(1,0) + invariant variables: 1, 2, 4 + invariant expressions: + +Improved to: + cost: 24 (complexity 0) + reg_cost: 6 + cand_cost: 10 + cand_group_cost: 8 (complexity 0) + candidates: 4, 7 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:7, cost=3D(5,0) + group:2 --> iv_cand:7, cost=3D(1,0) + invariant variables: 2, 4 + invariant expressions: + +Improved to: + cost: 19 (complexity 0) + reg_cost: 5 + cand_cost: 10 + cand_group_cost: 4 (complexity 0) + candidates: 4, 5 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:5, cost=3D(1,0) + group:2 --> iv_cand:4, cost=3D(1,0) + invariant variables: + invariant expressions: 3 + +Original cost 19 (complexity 0) + +Final cost 19 (complexity 0) + +Selected IV set for loop 1 at fp_foo.c:3, 10 avg niters, 2 IVs: +Candidate 4: + Var befor: ivtmp.9_28 + Var after: ivtmp.9_27 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) vector1_13(D) + Step: 4 + Object: (void *) vector1_13(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Var befor: ivtmp.10_25 + Var after: ivtmp.10_24 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) vector2_14(D) + Step: 4 + Object: (void *) vector2_14(D) + Biv: N + Overflowness wrto loop niter: Overflow + +Replacing exit test: if (n_12(D) > i_17) +tree_ssa_iv_optimize +;; +;; Loop 3 +;; header 8, latch 13 +;; depth 3, outer 2, finite_p +;; niter _87 > 0 ? (unsigned int) _87 + 4294967295 : 0 +;; upper_bound 2147483645 +;; likely_upper_bound 2147483645 +;; iterations by profile: 7.090909 (unreliable, maybe flat) entry count:1= 18111600 (estimated locally, freq 65.4628) +;; nodes: 8 13 +Processing loop 3 at fp_foo.c:3 + single exit 8 -> 9, exit condition if (i_40 < _87) + + + +Loops in function: dgefa +loop_0 (header =3D 0, latch =3D 1) +{ + bb_2 (preds =3D {bb_0 }, succs =3D {bb_10 bb_14 }) + { + [local count: 1804255]: + _45 =3D n_23(D) + -1; + if (n_23(D) > 1) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_14 (preds =3D {bb_2 }, succs =3D {bb_3 }) + { + [local count: 198468]: + + } + bb_3 (preds =3D {bb_14 bb_16 }, succs =3D {bb_1 }) + { + [local count: 1804255]: + # .MEM_88 =3D PHI <.MEM_22(D)(14), .MEM_53(16)> + # VUSE <.MEM_88> + return; + + } + bb_10 (preds =3D {bb_2 }, succs =3D {bb_4 }) + { + [local count: 1605787]: + + } + bb_16 (preds =3D {bb_5 }, succs =3D {bb_3 }) + { + [local count: 1605787]: + # .MEM_53 =3D PHI <.MEM_89(5)> + goto ; [100.00%] + + } + loop_1 (header =3D 4, latch =3D 11, finite_p + niter (unsigned int) n_23(D) + 4294967294 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:160= 5787 (estimated locally, freq 0.8900)) + { + bb_4 (preds =3D {bb_11 bb_10 }, succs =3D {bb_6 bb_15 }) + { + [local count: 14598063]: + # i_50 =3D PHI + # .MEM_54 =3D PHI <.MEM_89(11), .MEM_22(D)(10)> + j_24 =3D i_50 + 1; + if (n_23(D) > j_24) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_15 (preds =3D {bb_4 }, succs =3D {bb_5 }) + { + [local count: 1605787]: + + } + bb_5 (preds =3D {bb_15 bb_17 }, succs =3D {bb_11 bb_16 }) + { + [local count: 14598063]: + # .MEM_89 =3D PHI <.MEM_54(15), .MEM_86(17)> + if (j_24 < _45) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_11 (preds =3D {bb_5 }, succs =3D {bb_4 }) + { + [local count: 12992276]: + goto ; [100.00%] + + } + bb_6 (preds =3D {bb_4 }, succs =3D {bb_7 }) + { + [local count: 12992276]: + _6 =3D m_25(D) * i_50; + _7 =3D _6 + i_50; + _8 =3D (sizetype) _7; + _9 =3D _8 + 1; + _10 =3D _9 * 4; + _87 =3D n_23(D) - j_24; + + } + bb_17 (preds =3D {bb_9 }, succs =3D {bb_5 }) + { + [local count: 12992276]: + # .MEM_86 =3D PHI <.MEM_55(9)> + goto ; [100.00%] + + } + loop_2 (header =3D 7, latch =3D 12, finite_p + niter ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 2992276 (estimated locally, freq 7.2009)) + { + bb_7 (preds =3D {bb_12 bb_6 }, succs =3D {bb_8 }) + { + [local count: 118111600]: + # j_51 =3D PHI + # .MEM_52 =3D PHI <.MEM_55(12), .MEM_54(6)> + _1 =3D m_25(D) * j_51; + _2 =3D _1 + l_26(D); + _3 =3D (long unsigned int) _2; + _4 =3D _3 * 4; + _5 =3D vector_27(D) + _4; + # VUSE <.MEM_52> + t_28 =3D *_5; + _11 =3D _1 + i_50; + _12 =3D (sizetype) _11; + _13 =3D _12 + 1; + _14 =3D _13 * 4; + + } + bb_9 (preds =3D {bb_8 }, succs =3D {bb_12 bb_17 }) + { + [local count: 118111600]: + # .MEM_55 =3D PHI <.MEM_42(8)> + j_30 =3D j_51 + 1; + if (n_23(D) > j_30) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_12 (preds =3D {bb_9 }, succs =3D {bb_7 }) + { + [local count: 105119324]: + goto ; [100.00%] + + } + loop_3 (header =3D 8, latch =3D 13, finite_p + niter _87 > 0 ? (unsigned int) _87 + 4294967295 : 0 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 7.090909 (unreliable, maybe flat) entry count= :118111600 (estimated locally, freq 65.4628)) + { + bb_8 (preds =3D {bb_13 bb_7 }, succs =3D {bb_13 bb_9 }) + { + [local count: 955630225]: + # i_56 =3D PHI + # .MEM_57 =3D PHI <.MEM_42(13), .MEM_52(7)> + _32 =3D (long unsigned int) i_56; + _33 =3D _32 * 4; + _21 =3D _10 + _33; + _34 =3D vector_27(D) + _21; + # VUSE <.MEM_57> + _35 =3D *_34; + _29 =3D _14 + _33; + _36 =3D vector_27(D) + _29; + # VUSE <.MEM_57> + _37 =3D *_36; + _38 =3D t_28 * _37; + _39 =3D _35 + _38; + # .MEM_42 =3D VDEF <.MEM_57> + *_34 =3D _39; + i_40 =3D i_56 + 1; + if (i_40 < _87) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_13 (preds =3D {bb_8 }, succs =3D {bb_8 }) + { + [local count: 850510901]: + goto ; [100.00%] + + } + } + } + } +} +Analyzing # of iterations of loop 3 + exit condition [1, + , 1](no_overflow) < _87 + bounds on difference of bases: -2147483649 ... 2147483646 + result: + zero if _87 <=3D 0 + # of iterations (unsigned int) _87 + 4294967295, bounded by 2147483646 + number of iterations (unsigned int) _87 + 4294967295; zero if _87 <=3D 0 + +: +IV struct: + SSA_NAME: _21 + Type: sizetype + Base: ((sizetype) _7 + 1) * 4 + Step: 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _29 + Type: sizetype + Base: ((sizetype) _11 + 1) * 4 + Step: 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _32 + Type: long unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _33 + Type: long unsigned int + Base: 0 + Step: 4 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _34 + Type: float * + Base: vector_27(D) + ((sizetype) _7 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _36 + Type: float * + Base: vector_27(D) + ((sizetype) _11 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: i_40 + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: i_56 + Type: int + Base: 0 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow + +: +Group 0: + Type: REFERENCE ADDRESS + Use 0.0: + At stmt: _35 =3D *_34; + At pos: *_34 + IV struct: + Type: float * + Base: vector_27(D) + ((sizetype) _7 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow + Use 0.1: + At stmt: *_34 =3D _39; + At pos: *_34 + IV struct: + Type: float * + Base: vector_27(D) + ((sizetype) _7 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 1: + Type: REFERENCE ADDRESS + Use 1.0: + At stmt: _37 =3D *_36; + At pos: *_36 + IV struct: + Type: float * + Base: vector_27(D) + ((sizetype) _11 + 1) * 4 + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 2: + Type: COMPARE + Use 2.0: + At stmt: if (i_40 < _87) + At pos: i_40 + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow + +Predict doloop failure due to target specific checks. +Candidate 0: + Var befor: ivtmp.20 + Var after: ivtmp.20 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 1: + Var befor: ivtmp.21 + Var after: ivtmp.21 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 2: + Var befor: ivtmp.22 + Var after: ivtmp.22 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Var befor: ivtmp.23 + Var after: ivtmp.23 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + ((sizetype) _7 + 1) * 4) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Var befor: ivtmp.24 + Var after: ivtmp.24 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) ((sizetype) _7 * 4) + (unsigned long) vecto= r_27(D) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.25 + Var after: ivtmp.25 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + ((sizetype) _11 + 1) * 4) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 7: + Var befor: ivtmp.26 + Var after: ivtmp.26 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) ((sizetype) _11 * 4) + (unsigned long) vect= or_27(D) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 8: + Var befor: ivtmp.27 + Var after: ivtmp.27 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 9: + Var befor: ivtmp.28 + Var after: ivtmp.28 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 0 + Step: 4 + Biv: N + Overflowness wrto loop niter: No-overflow + +: 0, 1, 2, 3, + + Related: + Group 0: 0, 1, 2, 3, 4, 5, 9 + Group 1: 0, 1, 2, 3, 6, 7, 9 + Group 2: 0, 1, 2, 3, 8 + +: + cand cost + 0 5 + 1 5 + 2 5 + 3 4 + 4 6 + 5 6 + 6 6 + 7 6 + 8 5 + 9 5 + + +: +Inv 6: _7 (eliminable) +Inv 1: _10 (eliminable) +Inv 7: _11 (eliminable) +Inv 3: _14 (eliminable) +Inv 2: vector_27(D) (eliminable) +Inv 4: t_28 (eliminable) +Inv 5: _87 (eliminable) + +: +inv_expr 1: ((unsigned long) _7 * 4 + (unsigned long) vector_27(D)) + 4 +inv_expr 2: (unsigned long) _7 * 4 + (unsigned long) vector_27(D) +inv_expr 3: ((unsigned long) _7 - (unsigned long) _11) * 4 +inv_expr 4: ((unsigned long) _11 * 18446744073709551612 + (unsigned lon= g) _7 * 4) + 4 +inv_expr 5: ((unsigned long) _11 * 4 + (unsigned long) vector_27(D)) + = 4 +inv_expr 6: (unsigned long) _11 * 4 + (unsigned long) vector_27(D) +inv_expr 7: ((unsigned long) _11 - (unsigned long) _7) * 4 +inv_expr 8: ((unsigned long) _7 * 18446744073709551612 + (unsigned long= ) _11 * 4) + 4 + +: +Group 0: + cand cost compl. inv.expr. inv.vars + 1 22 0 1; NIL; + 2 22 0 2; NIL; + 4 2 0 NIL; NIL; + 5 2 2 NIL; NIL; + 6 16 0 3; NIL; + 7 18 0 4; NIL; + 9 14 0 1; NIL; + +Group 1: + cand cost compl. inv.expr. inv.vars + 1 11 0 5; NIL; + 2 11 0 6; NIL; + 4 8 0 7; NIL; + 5 9 0 8; NIL; + 6 1 0 NIL; NIL; + 7 1 1 NIL; NIL; + 9 7 0 5; NIL; + +Group 2: + cand cost compl. inv.expr. inv.vars + 0 0 0 NIL; 5 + 1 0 0 NIL; 5 + 2 4 0 NIL; 5 + 3 0 0 NIL; 5 + 8 4 0 NIL; 5 + + +: + target_avail_regs 26 + target_clobbered_regs 16 + target_reg_cost 4 + target_spill_cost 24 + regs_used 0 + cost for size: + ivs cost + 0 0 + 1 2 + 2 4 + 3 6 + 4 8 + 5 10 + 6 12 + 7 14 + 8 16 + 9 18 + 10 20 + 11 22 + 12 24 + 13 26 + 14 28 + 15 30 + 16 32 + 17 34 + 18 36 + 19 38 + 20 40 + 21 42 + 22 44 + 23 115 + 24 120 + 25 125 + 26 130 + 27 179 + 28 228 + 29 277 + 30 326 + 31 375 + 32 424 + 33 473 + 34 522 + 35 571 + 36 620 + 37 669 + 38 718 + 39 767 + 40 816 + 41 865 + 42 914 + 43 963 + 44 1012 + 45 1061 + 46 1110 + 47 1159 + 48 1208 + 49 1257 + 50 1306 + 51 1355 + 52 1404 + +Initial set of candidates: + cost: 43 (complexity 0) + reg_cost: 5 + cand_cost: 5 + cand_group_cost: 33 (complexity 0) + candidates: 1 + group:0 --> iv_cand:1, cost=3D(22,0) + group:1 --> iv_cand:1, cost=3D(11,0) + group:2 --> iv_cand:1, cost=3D(0,0) + invariant variables: 5 + invariant expressions: 1, 5 + +Improved to: + cost: 27 (complexity 0) + reg_cost: 6 + cand_cost: 11 + cand_group_cost: 10 (complexity 0) + candidates: 1, 4 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:4, cost=3D(8,0) + group:2 --> iv_cand:1, cost=3D(0,0) + invariant variables: 5 + invariant expressions: 7 + +Improved to: + cost: 26 (complexity 0) + reg_cost: 6 + cand_cost: 10 + cand_group_cost: 10 (complexity 0) + candidates: 3, 4 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:4, cost=3D(8,0) + group:2 --> iv_cand:3, cost=3D(0,0) + invariant variables: 5 + invariant expressions: 7 + +Initial set of candidates: + cost: 37 (complexity 0) + reg_cost: 7 + cand_cost: 9 + cand_group_cost: 21 (complexity 0) + candidates: 3, 9 + group:0 --> iv_cand:9, cost=3D(14,0) + group:1 --> iv_cand:9, cost=3D(7,0) + group:2 --> iv_cand:3, cost=3D(0,0) + invariant variables: 5 + invariant expressions: 1, 5 + +Improved to: + cost: 26 (complexity 0) + reg_cost: 6 + cand_cost: 10 + cand_group_cost: 10 (complexity 0) + candidates: 3, 4 + group:0 --> iv_cand:4, cost=3D(2,0) + group:1 --> iv_cand:4, cost=3D(8,0) + group:2 --> iv_cand:3, cost=3D(0,0) + invariant variables: 5 + invariant expressions: 7 + +Original cost 26 (complexity 0) + +Final cost 26 (complexity 0) + +Selected IV set for loop 3 at fp_foo.c:3, 10 avg niters, 2 IVs: +Candidate 3: + Var befor: i_56 + Var after: i_40 + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Var befor: ivtmp.23_85 + Var after: ivtmp.23_84 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + ((sizetype) _7 + 1) * 4) + Step: 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow + + allowed multipliers: + +;; +;; Loop 2 +;; header 7, latch 12 +;; depth 2, outer 1, finite_p +;; niter ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 +;; upper_bound 2147483645 +;; likely_upper_bound 2147483645 +;; iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 2992276 (estimated locally, freq 7.2009) +;; nodes: 7 12 9 8 13 +Processing loop 2 at fp_foo.c:9 + single exit 9 -> 17, exit condition if (n_23(D) > j_30) + + + +Loops in function: dgefa +loop_0 (header =3D 0, latch =3D 1) +{ + bb_2 (preds =3D {bb_0 }, succs =3D {bb_10 bb_14 }) + { + [local count: 1804255]: + _45 =3D n_23(D) + -1; + if (n_23(D) > 1) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_14 (preds =3D {bb_2 }, succs =3D {bb_3 }) + { + [local count: 198468]: + + } + bb_3 (preds =3D {bb_14 bb_16 }, succs =3D {bb_1 }) + { + [local count: 1804255]: + # .MEM_88 =3D PHI <.MEM_22(D)(14), .MEM_53(16)> + # VUSE <.MEM_88> + return; + + } + bb_10 (preds =3D {bb_2 }, succs =3D {bb_4 }) + { + [local count: 1605787]: + + } + bb_16 (preds =3D {bb_5 }, succs =3D {bb_3 }) + { + [local count: 1605787]: + # .MEM_53 =3D PHI <.MEM_89(5)> + goto ; [100.00%] + + } + loop_1 (header =3D 4, latch =3D 11, finite_p + niter (unsigned int) n_23(D) + 4294967294 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:160= 5787 (estimated locally, freq 0.8900)) + { + bb_4 (preds =3D {bb_11 bb_10 }, succs =3D {bb_6 bb_15 }) + { + [local count: 14598063]: + # i_50 =3D PHI + # .MEM_54 =3D PHI <.MEM_89(11), .MEM_22(D)(10)> + j_24 =3D i_50 + 1; + if (n_23(D) > j_24) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_15 (preds =3D {bb_4 }, succs =3D {bb_5 }) + { + [local count: 1605787]: + + } + bb_5 (preds =3D {bb_15 bb_17 }, succs =3D {bb_11 bb_16 }) + { + [local count: 14598063]: + # .MEM_89 =3D PHI <.MEM_54(15), .MEM_86(17)> + if (j_24 < _45) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_11 (preds =3D {bb_5 }, succs =3D {bb_4 }) + { + [local count: 12992276]: + goto ; [100.00%] + + } + bb_6 (preds =3D {bb_4 }, succs =3D {bb_7 }) + { + [local count: 12992276]: + _6 =3D m_25(D) * i_50; + _7 =3D _6 + i_50; + _8 =3D (sizetype) _7; + _9 =3D _8 + 1; + _10 =3D _9 * 4; + _87 =3D n_23(D) - j_24; + + } + bb_17 (preds =3D {bb_9 }, succs =3D {bb_5 }) + { + [local count: 12992276]: + # .MEM_86 =3D PHI <.MEM_55(9)> + goto ; [100.00%] + + } + loop_2 (header =3D 7, latch =3D 12, finite_p + niter ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 2992276 (estimated locally, freq 7.2009)) + { + bb_7 (preds =3D {bb_12 bb_6 }, succs =3D {bb_8 }) + { + [local count: 118111600]: + # j_51 =3D PHI + # .MEM_52 =3D PHI <.MEM_55(12), .MEM_54(6)> + _1 =3D m_25(D) * j_51; + _2 =3D _1 + l_26(D); + _3 =3D (long unsigned int) _2; + _4 =3D _3 * 4; + _5 =3D vector_27(D) + _4; + # VUSE <.MEM_52> + t_28 =3D *_5; + _11 =3D _1 + i_50; + _12 =3D (sizetype) _11; + _13 =3D _12 + 1; + _14 =3D _13 * 4; + _82 =3D (sizetype) _7; + _81 =3D _82 + 1; + _80 =3D _81 * 4; + _79 =3D vector_27(D) + _80; + ivtmp.23_83 =3D (unsigned long) _79; + + } + bb_9 (preds =3D {bb_8 }, succs =3D {bb_12 bb_17 }) + { + [local count: 118111600]: + # .MEM_55 =3D PHI <.MEM_42(8)> + j_30 =3D j_51 + 1; + if (n_23(D) > j_30) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_12 (preds =3D {bb_9 }, succs =3D {bb_7 }) + { + [local count: 105119324]: + goto ; [100.00%] + + } + loop_3 (header =3D 8, latch =3D 13, finite_p + niter _87 > 0 ? (unsigned int) _87 + 4294967295 : 0 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 7.090909 (unreliable, maybe flat) entry count= :118111600 (estimated locally, freq 65.4628)) + { + bb_8 (preds =3D {bb_13 bb_7 }, succs =3D {bb_13 bb_9 }) + { + [local count: 955630225]: + # i_56 =3D PHI + # .MEM_57 =3D PHI <.MEM_42(13), .MEM_52(7)> + # ivtmp.23_85 =3D PHI + _32 =3D (long unsigned int) i_56; + _33 =3D _32 * 4; + _21 =3D _10 + _33; + _34 =3D vector_27(D) + _21; + _78 =3D (void *) ivtmp.23_85; + # VUSE <.MEM_57> + _35 =3D MEM[(float *)_78]; + _29 =3D _14 + _33; + _36 =3D vector_27(D) + _29; + _76 =3D (sizetype) _7; + _75 =3D _76 * 18446744073709551612; + _74 =3D _75 + ivtmp.23_85; + _73 =3D (void *) _74; + _72 =3D (sizetype) _11; + _71 =3D _72 * 4; + _70 =3D _73 + _71; + # VUSE <.MEM_57> + _37 =3D MEM[(float *)_70]; + _38 =3D t_28 * _37; + _39 =3D _35 + _38; + _77 =3D (void *) ivtmp.23_85; + # .MEM_42 =3D VDEF <.MEM_57> + MEM[(float *)_77] =3D _39; + i_40 =3D i_56 + 1; + ivtmp.23_84 =3D ivtmp.23_85 + 4; + if (i_40 < _87) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_13 (preds =3D {bb_8 }, succs =3D {bb_8 }) + { + [local count: 850510901]: + goto ; [100.00%] + + } + } + } + } +} +Analyzing # of iterations of loop 2 + exit condition [i_50 + 2, + , 1](no_overflow) < n_23(D) + bounds on difference of bases: 0 ... 2147483645 + result: + # of iterations ((unsigned int) n_23(D) - (unsigned int) i_50) - 2, bo= unded by 2147483645 + number of iterations ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 + +: +IV struct: + SSA_NAME: _1 + Type: int + Base: (i_50 + 1) * m_25(D) + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _2 + Type: int + Base: (i_50 + 1) * m_25(D) + l_26(D) + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _3 + Type: long unsigned int + Base: (long unsigned int) ((i_50 + 1) * m_25(D)) + (long unsigned= int) l_26(D) + Step: (long unsigned int) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _4 + Type: long unsigned int + Base: ((long unsigned int) ((i_50 + 1) * m_25(D)) + (long unsigne= d int) l_26(D)) * 4 + Step: (long unsigned int) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _5 + Type: float * + Base: vector_27(D) + ((long unsigned int) ((i_50 + 1) * m_25(D)) = + (long unsigned int) l_26(D)) * 4 + Step: (long unsigned int) m_25(D) * 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _11 + Type: int + Base: (i_50 + 1) * m_25(D) + i_50 + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _12 + Type: sizetype + Base: (sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50 + Step: (sizetype) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _13 + Type: sizetype + Base: ((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1 + Step: (sizetype) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _14 + Type: sizetype + Base: (((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1)= * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: j_30 + Type: int + Base: i_50 + 2 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: j_51 + Type: int + Base: i_50 + 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _71 + Type: sizetype + Base: ((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _72 + Type: sizetype + Base: (sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50 + Step: (sizetype) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow + +: +Group 0: + Type: REFERENCE ADDRESS + Use 0.0: + At stmt: t_28 =3D *_5; + At pos: *_5 + IV struct: + Type: float * + Base: vector_27(D) + ((long unsigned int) ((i_50 + 1) * m_25(D)) = + (long unsigned int) l_26(D)) * 4 + Step: (long unsigned int) m_25(D) * 4 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 1: + Type: COMPARE + Use 1.0: + At stmt: if (n_23(D) > j_30) + At pos: j_30 + IV struct: + Type: int + Base: i_50 + 2 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 2: + Type: GENERIC + Use 2.0: + At stmt: _14 =3D _13 * 4; + At pos: + IV struct: + Type: sizetype + Base: (((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1)= * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +Group 3: + Type: GENERIC + Use 3.0: + At stmt: _71 =3D _72 * 4; + At pos: + IV struct: + Type: sizetype + Base: ((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow + +Predict doloop failure due to target specific checks. +Candidate 0: + Var befor: ivtmp.29 + Var after: ivtmp.29 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 1: + Var befor: ivtmp.30 + Var after: ivtmp.30 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 2: + Var befor: ivtmp.31 + Var after: ivtmp.31 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: (sizetype) (i_50 + 2) + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Var befor: ivtmp.32 + Var after: ivtmp.32 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: (sizetype) (i_50 + 1) + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Incr POS: orig biv + IV struct: + Type: int + Base: i_50 + 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Depend on inv.exprs: 1 + Var befor: ivtmp.33 + Var after: ivtmp.33 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + ((long unsigned int) ((i_50= + 1) * m_25(D)) + (long unsigned int) l_26(D)) * 4) + Step: (unsigned long) ((long unsigned int) m_25(D) * 4) + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.34 + Var after: ivtmp.34 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) (i_50 + 2) + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 7: + Var befor: ivtmp.35 + Var after: ivtmp.35 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) i_50 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 8: + Depend on inv.exprs: 1 + Var befor: ivtmp.36 + Var after: ivtmp.36 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: (((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) + 1)= * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 9: + Depend on inv.exprs: 1 + Var befor: ivtmp.37 + Var after: ivtmp.37 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: ((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 10: + Depend on inv.exprs: 1 + Var befor: ivtmp.38 + Var after: ivtmp.38 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: 0 + Step: (long unsigned int) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow + +: 0, 1, 2, 3, 4, + + Related: + Group 0: 0, 1, 2, 3, 4, 5, 10 + Group 1: 0, 1, 2, 3, 4, 6, 7 + Group 2: 0, 1, 2, 3, 4, 8, 9, 10 + Group 3: 0, 1, 2, 3, 4, 9, 10 + +: + cand cost + 0 5 + 1 5 + 2 6 + 3 6 + 4 4 + 5 9 + 6 5 + 7 5 + 8 10 + 9 9 + 10 5 + +Scaling cost based on bb prob by 8.00: 6 (scratch: 2) -> 34 +Scaling cost based on bb prob by 8.00: 4 (scratch: 0) -> 32 +Scaling cost based on bb prob by 8.00: 0 (scratch: 0) -> 0 +Scaling cost based on bb prob by 8.00: 8 (scratch: 4) -> 36 + +: +Inv 6: _7 +Inv 8: _10 +Inv 7: n_23(D) (eliminable) +Inv 1: j_24 (eliminable) +Inv 2: m_25(D) (eliminable) +Inv 3: l_26(D) (eliminable) +Inv 4: vector_27(D) +Inv 5: i_50 (eliminable) +Inv 9: _87 + +: +inv_expr 1: (long unsigned int) m_25(D) * 4 +inv_expr 2: (((unsigned long) l_26(D) * 4 + (unsigned long) vector_27(D= )) - (unsigned long) i_50 * 4) + 18446744073709551612 +inv_expr 3: ((unsigned long) l_26(D) * 4 + (unsigned long) vector_27(D)= ) - (unsigned long) i_50 * 4 +inv_expr 4: ((unsigned long) ((i_50 + 1) * m_25(D)) + (unsigned long) l= _26(D)) * 4 + (unsigned long) vector_27(D) +inv_expr 5: ((unsigned int) n_23(D) - (unsigned int) i_50) + 4294967295 +inv_expr 6: (signed int) i_50 + 1 +inv_expr 7: (unsigned long) (((unsigned int) n_23(D) - (unsigned int) i= _50) + 4294967294) + 1 +inv_expr 8: ((sizetype) i_50 + (sizetype) (((unsigned int) n_23(D) - (u= nsigned int) i_50) + 4294967294)) + 3 +inv_expr 9: ((sizetype) i_50 + (sizetype) (((unsigned int) n_23(D) - (u= nsigned int) i_50) + 4294967294)) + 2 +inv_expr 10: (((signed long) i_50 * 4 - (signed long) vector_27(D)) - (s= igned long) l_26(D) * 4) + 4 +inv_expr 11: (((signed long) ((i_50 + 1) * m_25(D)) + (signed long) i_50= ) + 1) * 4 +inv_expr 12: ((signed long) i_50 * 4 - (signed long) vector_27(D)) - (si= gned long) l_26(D) * 4 +inv_expr 13: ((signed long) ((i_50 + 1) * m_25(D)) + (signed long) i_50)= * 4 + +: +Group 0: + cand cost compl. inv.expr. inv.vars + 5 1 0 NIL; NIL; + 8 9 0 2; NIL; + 9 8 0 3; NIL; + 10 10 0 4; NIL; + +Group 1: + cand cost compl. inv.expr. inv.vars + 0 0 0 5; NIL; + 1 2 0 7; NIL; + 2 3 0 8; NIL; + 3 0 0 NIL; 7 + 4 0 0 NIL; 7 + 6 0 0 NIL; 7 + 7 0 0 NIL; 7 + +Group 2: + cand cost compl. inv.expr. inv.vars + 5 7 0 10; NIL; + 8 0 0 NIL; NIL; + 9 4 0 NIL; NIL; + 10 9 0 11; NIL; + +Group 3: + cand cost compl. inv.expr. inv.vars + 5 34 0 12; NIL; + 8 32 0 NIL; NIL; + 9 0 0 NIL; NIL; + 10 36 0 13; NIL; + + +: + target_avail_regs 26 + target_clobbered_regs 16 + target_reg_cost 4 + target_spill_cost 24 + regs_used 4 + cost for size: + ivs cost + 0 0 + 1 2 + 2 4 + 3 6 + 4 8 + 5 10 + 6 12 + 7 14 + 8 16 + 9 18 + 10 20 + 11 22 + 12 24 + 13 26 + 14 28 + 15 30 + 16 32 + 17 34 + 18 36 + 19 111 + 20 116 + 21 121 + 22 126 + 23 151 + 24 176 + 25 201 + 26 226 + 27 275 + 28 324 + 29 373 + 30 422 + 31 471 + 32 520 + 33 569 + 34 618 + 35 667 + 36 716 + 37 765 + 38 814 + 39 863 + 40 912 + 41 961 + 42 1010 + 43 1059 + 44 1108 + 45 1157 + 46 1206 + 47 1255 + 48 1304 + 49 1353 + 50 1402 + 51 1451 + 52 1500 + +Initial set of candidates: + cost: 63 (complexity 0) + reg_cost: 8 + cand_cost: 13 + cand_group_cost: 42 (complexity 0) + candidates: 4, 5 + group:0 --> iv_cand:5, cost=3D(1,0) + group:1 --> iv_cand:4, cost=3D(0,0) + group:2 --> iv_cand:5, cost=3D(7,0) + group:3 --> iv_cand:5, cost=3D(34,0) + invariant variables: 7 + invariant expressions: 1, 10, 12 + +Improved to: + cost: 32 (complexity 0) + reg_cost: 7 + cand_cost: 13 + cand_group_cost: 12 (complexity 0) + candidates: 4, 9 + group:0 --> iv_cand:9, cost=3D(8,0) + group:1 --> iv_cand:4, cost=3D(0,0) + group:2 --> iv_cand:9, cost=3D(4,0) + group:3 --> iv_cand:9, cost=3D(0,0) + invariant variables: 7 + invariant expressions: 1, 3 + +Initial set of candidates: + cost: 32 (complexity 0) + reg_cost: 7 + cand_cost: 13 + cand_group_cost: 12 (complexity 0) + candidates: 4, 9 + group:0 --> iv_cand:9, cost=3D(8,0) + group:1 --> iv_cand:4, cost=3D(0,0) + group:2 --> iv_cand:9, cost=3D(4,0) + group:3 --> iv_cand:9, cost=3D(0,0) + invariant variables: 7 + invariant expressions: 1, 3 + +Original cost 32 (complexity 0) + +Final cost 32 (complexity 0) + +Selected IV set for loop 2 at fp_foo.c:9, 10 avg niters, 2 IVs: +Candidate 4: + Var befor: j_51 + Var after: j_30 + Incr POS: orig biv + IV struct: + Type: int + Base: i_50 + 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 9: + Depend on inv.exprs: 1 + Var befor: ivtmp.37_69 + Var after: ivtmp.37_68 + Incr POS: before exit test + IV struct: + Type: sizetype + Base: ((sizetype) ((i_50 + 1) * m_25(D)) + (sizetype) i_50) * 4 + Step: (sizetype) m_25(D) * 4 + Biv: N + Overflowness wrto loop niter: Overflow + +Replacing exit test: if (n_23(D) > j_30) +;; +;; Loop 1 +;; header 4, latch 11 +;; depth 1, outer 0, finite_p +;; niter (unsigned int) n_23(D) + 4294967294 +;; upper_bound 2147483645 +;; likely_upper_bound 2147483645 +;; iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 605787 (estimated locally, freq 0.8900) +;; nodes: 4 11 5 15 17 9 8 13 7 12 6 +Processing loop 1 at fp_foo.c:8 + single exit 5 -> 16, exit condition if (j_24 < _45) + + + +Loops in function: dgefa +loop_0 (header =3D 0, latch =3D 1) +{ + bb_2 (preds =3D {bb_0 }, succs =3D {bb_10 bb_14 }) + { + [local count: 1804255]: + _45 =3D n_23(D) + -1; + if (n_23(D) > 1) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_14 (preds =3D {bb_2 }, succs =3D {bb_3 }) + { + [local count: 198468]: + + } + bb_3 (preds =3D {bb_14 bb_16 }, succs =3D {bb_1 }) + { + [local count: 1804255]: + # .MEM_88 =3D PHI <.MEM_22(D)(14), .MEM_53(16)> + # VUSE <.MEM_88> + return; + + } + bb_10 (preds =3D {bb_2 }, succs =3D {bb_4 }) + { + [local count: 1605787]: + + } + bb_16 (preds =3D {bb_5 }, succs =3D {bb_3 }) + { + [local count: 1605787]: + # .MEM_53 =3D PHI <.MEM_89(5)> + goto ; [100.00%] + + } + loop_1 (header =3D 4, latch =3D 11, finite_p + niter (unsigned int) n_23(D) + 4294967294 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:160= 5787 (estimated locally, freq 0.8900)) + { + bb_4 (preds =3D {bb_11 bb_10 }, succs =3D {bb_6 bb_15 }) + { + [local count: 14598063]: + # i_50 =3D PHI + # .MEM_54 =3D PHI <.MEM_89(11), .MEM_22(D)(10)> + j_24 =3D i_50 + 1; + if (n_23(D) > j_24) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_15 (preds =3D {bb_4 }, succs =3D {bb_5 }) + { + [local count: 1605787]: + + } + bb_5 (preds =3D {bb_15 bb_17 }, succs =3D {bb_11 bb_16 }) + { + [local count: 14598063]: + # .MEM_89 =3D PHI <.MEM_54(15), .MEM_86(17)> + if (j_24 < _45) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_11 (preds =3D {bb_5 }, succs =3D {bb_4 }) + { + [local count: 12992276]: + goto ; [100.00%] + + } + bb_6 (preds =3D {bb_4 }, succs =3D {bb_7 }) + { + [local count: 12992276]: + _6 =3D m_25(D) * i_50; + _7 =3D _6 + i_50; + _8 =3D (sizetype) _7; + _9 =3D _8 + 1; + _10 =3D _9 * 4; + _87 =3D n_23(D) - j_24; + _67 =3D (sizetype) m_25(D); + _66 =3D _67 * 4; + _64 =3D i_50 + 1; + _63 =3D m_25(D) * _64; + _62 =3D (sizetype) _63; + _61 =3D (sizetype) i_50; + _60 =3D _61 + _62; + ivtmp.37_65 =3D _60 * 4; + + } + bb_17 (preds =3D {bb_9 }, succs =3D {bb_5 }) + { + [local count: 12992276]: + # .MEM_86 =3D PHI <.MEM_55(9)> + goto ; [100.00%] + + } + loop_2 (header =3D 7, latch =3D 12, finite_p + niter ((unsigned int) n_23(D) - (unsigned int) i_50) - 2 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 8.090909 (unreliable, maybe flat) entry count:1= 2992276 (estimated locally, freq 7.2009)) + { + bb_7 (preds =3D {bb_12 bb_6 }, succs =3D {bb_8 }) + { + [local count: 118111600]: + # j_51 =3D PHI + # .MEM_52 =3D PHI <.MEM_55(12), .MEM_54(6)> + # ivtmp.37_69 =3D PHI + _1 =3D m_25(D) * j_51; + _2 =3D _1 + l_26(D); + _3 =3D (long unsigned int) _2; + _4 =3D _3 * 4; + _5 =3D vector_27(D) + _4; + _59 =3D (sizetype) i_50; + _58 =3D _59 * 18446744073709551612; + _49 =3D (sizetype) l_26(D); + _48 =3D _49 * 4; + _47 =3D _48 + _58; + _46 =3D vector_27(D) + _47; + _44 =3D _46 + ivtmp.37_69; + # VUSE <.MEM_52> + t_28 =3D MEM[(float *)_44]; + _11 =3D _1 + i_50; + _12 =3D (sizetype) _11; + _13 =3D _12 + 1; + _14 =3D ivtmp.37_69 + 4; + _82 =3D (sizetype) _7; + _81 =3D _82 + 1; + _80 =3D _81 * 4; + _79 =3D vector_27(D) + _80; + ivtmp.23_83 =3D (unsigned long) _79; + + } + bb_9 (preds =3D {bb_8 }, succs =3D {bb_12 bb_17 }) + { + [local count: 118111600]: + # .MEM_55 =3D PHI <.MEM_42(8)> + j_30 =3D j_51 + 1; + ivtmp.37_68 =3D ivtmp.37_69 + _66; + if (j_30 !=3D n_23(D)) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_12 (preds =3D {bb_9 }, succs =3D {bb_7 }) + { + [local count: 105119324]: + goto ; [100.00%] + + } + loop_3 (header =3D 8, latch =3D 13, finite_p + niter _87 > 0 ? (unsigned int) _87 + 4294967295 : 0 + upper_bound 2147483645 + likely_upper_bound 2147483645 + iterations by profile: 7.090909 (unreliable, maybe flat) entry count= :118111600 (estimated locally, freq 65.4628)) + { + bb_8 (preds =3D {bb_13 bb_7 }, succs =3D {bb_13 bb_9 }) + { + [local count: 955630225]: + # i_56 =3D PHI + # .MEM_57 =3D PHI <.MEM_42(13), .MEM_52(7)> + # ivtmp.23_85 =3D PHI + _32 =3D (long unsigned int) i_56; + _33 =3D _32 * 4; + _21 =3D _10 + _33; + _34 =3D vector_27(D) + _21; + _78 =3D (void *) ivtmp.23_85; + # VUSE <.MEM_57> + _35 =3D MEM[(float *)_78]; + _29 =3D _14 + _33; + _36 =3D vector_27(D) + _29; + _76 =3D (sizetype) _7; + _75 =3D _76 * 18446744073709551612; + _74 =3D _75 + ivtmp.23_85; + _73 =3D (void *) _74; + _72 =3D (sizetype) _11; + _71 =3D ivtmp.37_69; + _70 =3D _73 + _71; + # VUSE <.MEM_57> + _37 =3D MEM[(float *)_70]; + _38 =3D t_28 * _37; + _39 =3D _35 + _38; + _77 =3D (void *) ivtmp.23_85; + # .MEM_42 =3D VDEF <.MEM_57> + MEM[(float *)_77] =3D _39; + i_40 =3D i_56 + 1; + ivtmp.23_84 =3D ivtmp.23_85 + 4; + if (i_40 < _87) + goto ; [89.00%] + else + goto ; [11.00%] + + } + bb_13 (preds =3D {bb_8 }, succs =3D {bb_8 }) + { + [local count: 850510901]: + goto ; [100.00%] + + } + } + } + } +} +Analyzing # of iterations of loop 1 + exit condition [1, + , 1](no_overflow) < n_23(D) + -1 + bounds on difference of bases: 0 ... 2147483645 + result: + # of iterations (unsigned int) n_23(D) + 4294967294, bounded by 214748= 3645 + number of iterations (unsigned int) n_23(D) + 4294967294 + +: +IV struct: + SSA_NAME: _6 + Type: int + Base: 0 + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _7 + Type: int + Base: 0 + Step: (int) ((unsigned int) m_25(D) + 1) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: j_24 + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _46 + Type: float * + Base: vector_27(D) + (sizetype) l_26(D) * 4 + Step: 18446744073709551612 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _47 + Type: sizetype + Base: (sizetype) l_26(D) * 4 + Step: 18446744073709551612 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: i_50 + Type: int + Base: 0 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _58 + Type: sizetype + Base: 0 + Step: 18446744073709551612 + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _59 + Type: sizetype + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _61 + Type: sizetype + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _63 + Type: int + Base: m_25(D) + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +IV struct: + SSA_NAME: _64 + Type: int + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +IV struct: + SSA_NAME: _87 + Type: int + Base: n_23(D) + -1 + Step: -1 + Biv: N + Overflowness wrto loop niter: Overflow + +: +Group 0: + Type: COMPARE + Use 0.0: + At stmt: if (n_23(D) > j_24) + At pos: j_24 + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 1: + Type: COMPARE + Use 1.0: + At stmt: if (j_24 < _45) + At pos: j_24 + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 2: + Type: GENERIC + Use 2.0: + At stmt: _7 =3D _6 + i_50; + At pos: + IV struct: + Type: int + Base: 0 + Step: (int) ((unsigned int) m_25(D) + 1) + Biv: N + Overflowness wrto loop niter: Overflow +Group 3: + Type: COMPARE + Use 3.0: + At stmt: if (i_40 < _87) + At pos: _87 + IV struct: + Type: int + Base: n_23(D) + -1 + Step: -1 + Biv: N + Overflowness wrto loop niter: Overflow +Group 4: + Type: GENERIC + Use 4.0: + At stmt: j_24 =3D i_50 + 1; + At pos: + IV struct: + Type: int + Base: 1 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 5: + Type: GENERIC + Use 5.0: + At stmt: _46 =3D vector_27(D) + _47; + At pos: + IV struct: + Type: float * + Base: vector_27(D) + (sizetype) l_26(D) * 4 + Step: 18446744073709551612 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: No-overflow +Group 6: + Type: GENERIC + Use 6.0: + At stmt: i_50 =3D PHI + At pos: + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: Y + Overflowness wrto loop niter: No-overflow +Group 7: + Type: GENERIC + Use 7.0: + At stmt: _63 =3D m_25(D) * _64; + At pos: + IV struct: + Type: int + Base: m_25(D) + Step: m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow +Group 8: + Type: GENERIC + Use 8.0: + At stmt: _61 =3D (sizetype) i_50; + At pos: + IV struct: + Type: sizetype + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow + +Predict doloop failure due to target specific checks. +Candidate 0: + Var befor: ivtmp.39 + Var after: ivtmp.39 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 1: + Var befor: ivtmp.40 + Var after: ivtmp.40 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 2: + Var befor: ivtmp.41 + Var after: ivtmp.41 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 1 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Depend on inv.exprs: 1 + Var befor: ivtmp.42 + Var after: ivtmp.42 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: (unsigned int) m_25(D) + 1 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Var befor: ivtmp.43 + Var after: ivtmp.43 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) (n_23(D) + -1) + Step: 4294967295 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 6: + Var befor: ivtmp.44 + Var after: ivtmp.44 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) n_23(D) + Step: 4294967295 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 7: + Var befor: ivtmp.45 + Var after: ivtmp.45 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + (sizetype) l_26(D) * 4) + Step: 18446744073709551612 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 8: + Var befor: ivtmp.46 + Var after: ivtmp.46 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) m_25(D) + Step: (unsigned int) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow + +: 0, 1, 2, 3, + + Related: + Group 0: 0, 1, 2, 3 + Group 1: 0, 1, 2, 3 + Group 2: 0, 1, 2, 3, 4 + Group 3: 0, 1, 2, 3, 5, 6 + Group 4: 0, 1, 2, 3 + Group 5: 0, 1, 2, 3, 7 + Group 6: 0, 1, 2, 3 + Group 7: 0, 1, 2, 3, 8 + Group 8: 0, 1, 2, 3 + +: + cand cost + 0 5 + 1 5 + 2 5 + 3 4 + 4 5 + 5 5 + 6 5 + 7 6 + 8 5 + +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 20.00: 0 (scratch: 0) -> 0 +Scaling cost based on bb prob by 20.00: 4 (scratch: 0) -> 80 +Scaling cost based on bb prob by 2.00: 9 (scratch: 1) -> 17 +Scaling cost based on bb prob by 2.00: 0 (scratch: 0) -> 0 + +: +Inv 1: n_23(D) +Inv 4: m_25(D) +Inv 5: l_26(D) +Inv 3: vector_27(D) +Inv 2: _45 (eliminable) + +: +inv_expr 1: (unsigned int) m_25(D) + 1 +inv_expr 2: (signed int) n_23(D) + 1 +inv_expr 3: (signed int) n_23(D) + -1 +inv_expr 4: (signed long) l_26(D) * 4 + (signed long) vector_27(D) + +: +Group 0: + cand cost compl. inv.expr. inv.vars + 0 4 0 NIL; NIL; + 1 4 0 NIL; NIL; + 2 0 0 NIL; NIL; + 3 0 0 NIL; NIL; + 5 4 0 NIL; NIL; + 6 4 0 2; NIL; + +Group 1: + cand cost compl. inv.expr. inv.vars + 0 0 0 NIL; NIL; + 1 0 0 NIL; 2 + 2 0 0 NIL; NIL; + 3 0 0 NIL; NIL; + 5 0 0 NIL; NIL; + 6 0 0 NIL; NIL; + 7 3 0 NIL; NIL; + +Group 2: + cand cost compl. inv.expr. inv.vars + 4 0 0 NIL; NIL; + +Group 3: + cand cost compl. inv.expr. inv.vars + 0 80 0 3; NIL; + 1 80 0 3; NIL; + 2 80 0 NIL; NIL; + 3 80 0 NIL; NIL; + 5 0 0 NIL; NIL; + 6 80 0 NIL; NIL; + +Group 4: + cand cost compl. inv.expr. inv.vars + 0 4 0 NIL; NIL; + 1 4 0 NIL; NIL; + 2 0 0 NIL; NIL; + 3 0 0 NIL; NIL; + 5 4 0 NIL; NIL; + 6 4 0 2; NIL; + +Group 5: + cand cost compl. inv.expr. inv.vars + 1 17 0 4; NIL; + 7 0 0 NIL; NIL; + +Group 6: + cand cost compl. inv.expr. inv.vars + 0 0 0 NIL; NIL; + 1 0 0 NIL; NIL; + 2 4 0 NIL; NIL; + 3 0 0 NIL; NIL; + 5 4 0 3; NIL; + 6 4 0 NIL; NIL; + +Group 7: + cand cost compl. inv.expr. inv.vars + 8 0 0 NIL; NIL; + +Group 8: + cand cost compl. inv.expr. inv.vars + 1 0 0 NIL; NIL; + + +: + target_avail_regs 26 + target_clobbered_regs 16 + target_reg_cost 4 + target_spill_cost 24 + regs_used 4 + cost for size: + ivs cost + 0 0 + 1 2 + 2 4 + 3 6 + 4 8 + 5 10 + 6 12 + 7 14 + 8 16 + 9 18 + 10 20 + 11 22 + 12 24 + 13 26 + 14 28 + 15 30 + 16 32 + 17 34 + 18 36 + 19 111 + 20 116 + 21 121 + 22 126 + 23 151 + 24 176 + 25 201 + 26 226 + 27 275 + 28 324 + 29 373 + 30 422 + 31 471 + 32 520 + 33 569 + 34 618 + 35 667 + 36 716 + 37 765 + 38 814 + 39 863 + 40 912 + 41 961 + 42 1010 + 43 1059 + 44 1108 + 45 1157 + 46 1206 + 47 1255 + 48 1304 + 49 1353 + 50 1402 + 51 1451 + 52 1500 + +Initial set of candidates: + cost: 126 (complexity 0) + reg_cost: 10 + cand_cost: 19 + cand_group_cost: 97 (complexity 0) + candidates: 1, 3, 4, 8 + group:0 --> iv_cand:3, cost=3D(0,0) + group:1 --> iv_cand:3, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:3, cost=3D(80,0) + group:4 --> iv_cand:3, cost=3D(0,0) + group:5 --> iv_cand:1, cost=3D(17,0) + group:6 --> iv_cand:3, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1, 4 + +Improved to: + cost: 53 (complexity 0) + reg_cost: 12 + cand_cost: 24 + cand_group_cost: 17 (complexity 0) + candidates: 1, 3, 4, 5, 8 + group:0 --> iv_cand:3, cost=3D(0,0) + group:1 --> iv_cand:3, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:5, cost=3D(0,0) + group:4 --> iv_cand:3, cost=3D(0,0) + group:5 --> iv_cand:1, cost=3D(17,0) + group:6 --> iv_cand:3, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1, 4 + +Improved to: + cost: 43 (complexity 0) + reg_cost: 13 + cand_cost: 30 + cand_group_cost: 0 (complexity 0) + candidates: 1, 3, 4, 5, 7, 8 + group:0 --> iv_cand:3, cost=3D(0,0) + group:1 --> iv_cand:3, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:5, cost=3D(0,0) + group:4 --> iv_cand:3, cost=3D(0,0) + group:5 --> iv_cand:7, cost=3D(0,0) + group:6 --> iv_cand:3, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1 + +Initial set of candidates: + cost: 55 (complexity 0) + reg_cost: 10 + cand_cost: 20 + cand_group_cost: 25 (complexity 0) + candidates: 1, 4, 5, 8 + group:0 --> iv_cand:5, cost=3D(4,0) + group:1 --> iv_cand:5, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:5, cost=3D(0,0) + group:4 --> iv_cand:5, cost=3D(4,0) + group:5 --> iv_cand:1, cost=3D(17,0) + group:6 --> iv_cand:1, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1, 4 + +Improved to: + cost: 45 (complexity 0) + reg_cost: 11 + cand_cost: 26 + cand_group_cost: 8 (complexity 0) + candidates: 1, 4, 5, 7, 8 + group:0 --> iv_cand:5, cost=3D(4,0) + group:1 --> iv_cand:5, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:5, cost=3D(0,0) + group:4 --> iv_cand:5, cost=3D(4,0) + group:5 --> iv_cand:7, cost=3D(0,0) + group:6 --> iv_cand:1, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1 + +Improved to: + cost: 43 (complexity 0) + reg_cost: 13 + cand_cost: 30 + cand_group_cost: 0 (complexity 0) + candidates: 1, 3, 4, 5, 7, 8 + group:0 --> iv_cand:3, cost=3D(0,0) + group:1 --> iv_cand:3, cost=3D(0,0) + group:2 --> iv_cand:4, cost=3D(0,0) + group:3 --> iv_cand:5, cost=3D(0,0) + group:4 --> iv_cand:3, cost=3D(0,0) + group:5 --> iv_cand:7, cost=3D(0,0) + group:6 --> iv_cand:3, cost=3D(0,0) + group:7 --> iv_cand:8, cost=3D(0,0) + group:8 --> iv_cand:1, cost=3D(0,0) + invariant variables: + invariant expressions: 1 + +Original cost 43 (complexity 0) + +Final cost 43 (complexity 0) + +Selected IV set for loop 1 at fp_foo.c:8, 10 avg niters, 6 IVs: +Candidate 1: + Var befor: ivtmp.40_43 + Var after: ivtmp.40_41 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 3: + Var befor: i_50 + Var after: j_24 + Incr POS: orig biv + IV struct: + Type: int + Base: 0 + Step: 1 + Biv: N + Overflowness wrto loop niter: No-overflow +Candidate 4: + Depend on inv.exprs: 1 + Var befor: ivtmp.42_31 + Var after: ivtmp.42_20 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: 0 + Step: (unsigned int) m_25(D) + 1 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 5: + Var befor: ivtmp.43_17 + Var after: ivtmp.43_16 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) (n_23(D) + -1) + Step: 4294967295 + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 7: + Var befor: ivtmp.45_91 + Var after: ivtmp.45_92 + Incr POS: before exit test + IV struct: + Type: unsigned long + Base: (unsigned long) (vector_27(D) + (sizetype) l_26(D) * 4) + Step: 18446744073709551612 + Object: (void *) vector_27(D) + Biv: N + Overflowness wrto loop niter: Overflow +Candidate 8: + Var befor: ivtmp.46_97 + Var after: ivtmp.46_98 + Incr POS: before exit test + IV struct: + Type: unsigned int + Base: (unsigned int) m_25(D) + Step: (unsigned int) m_25(D) + Biv: N + Overflowness wrto loop niter: Overflow + +Replacing exit test: if (j_24 < _45) diff --git a/gcc/testsuite/fp_foo.c b/gcc/testsuite/fp_foo.c new file mode 100644 index 00000000000..f65f43d6435 --- /dev/null +++ b/gcc/testsuite/fp_foo.c @@ -0,0 +1,19 @@ + +void daxpy(float *vector1, float *vector2, int n, float fp_const){ + for (int i =3D 0; i < n; ++i) + vector1[i] +=3D fp_const * vector2[i]; +} + +void dgefa(float *vector, int m, int n, int l){ + for (int i =3D 0; i < n - 1; ++i){ + for (int j =3D i + 1; j < n; ++j){ + float t =3D vector[m * j + l]; + daxpy(&vector[m * i + i + 1], + &vector[m * j + i + 1], n - (i + 1), t); + } + } +} + +int main(){ + return 0; +} diff --git a/gcc/testsuite/test_script.sh b/gcc/testsuite/test_script.sh new file mode 100644 index 00000000000..4f19d248efe --- /dev/null +++ b/gcc/testsuite/test_script.sh @@ -0,0 +1,10 @@ +export PREFIX=3D"/home/syrmia/Desktop/Aleksandar/GNU_toolchain/install" +export SOURCE_DIR=3D"/home/syrmia/Desktop/Aleksandar/GNU_toolchain/source" +export BUILD_DIR=3D"/home/syrmia/Desktop/Aleksandar/GNU_toolchain/build" +export SYSROOT=3D"/home/syrmia/Desktop/Aleksandar/GNU_toolchain/install/sy= s_root" +export PATH=3D$PREFIX/bin:$PATH +export TARGET=3Dmips64-r6-linux-gnu + + +$PREFIX/bin/mips64-r6-linux-gnu-gcc fp_foo.c -O2 >out.txt -S -o fp_foo.s -= march=3Dmips64r6 -mabi=3D64 + diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc index 7cae5bdefea..2dec5001dca 100644 --- a/gcc/tree-ssa-loop-ivopts.cc +++ b/gcc/tree-ssa-loop-ivopts.cc @@ -4724,7 +4724,8 @@ get_address_cost (struct ivopts_data *data, struct iv= _use *use, rtx addr; bool simple_inv =3D true; tree comp_inv =3D NULL_TREE, type =3D aff_var->type; - comp_cost var_cost =3D no_cost, cost =3D no_cost; + comp_cost var_cost =3D no_cost, cost =3D no_cost, autoinc_cost =3D no_co= st; + comp_cost acost =3D no_cost; struct mem_address parts =3D {NULL_TREE, integer_one_node, NULL_TREE, NULL_TREE, NULL_TREE}; machine_mode addr_mode =3D TYPE_MODE (type); @@ -4755,38 +4756,36 @@ get_address_cost (struct ivopts_data *data, struct = iv_use *use, if (!ok_with_ratio_p) parts.step =3D NULL_TREE; } - if (ok_with_ratio_p || ok_without_ratio_p) + if (!(ok_with_ratio_p || ok_without_ratio_p)) + parts.index =3D NULL_TREE; + + if (maybe_ne (aff_inv->offset, 0)) { - if (maybe_ne (aff_inv->offset, 0)) - { - parts.offset =3D wide_int_to_tree (sizetype, aff_inv->offset)= ; - /* Addressing mode "base + index [<< scale] + offset". */ - if (!valid_mem_ref_p (mem_mode, as, &parts, code)) - parts.offset =3D NULL_TREE; - else - aff_inv->offset =3D 0; - } + parts.offset =3D wide_int_to_tree (sizetype, aff_inv->offset); + /* Addressing mode "base + index[<< scale] + offset". */ + if (!valid_mem_ref_p (mem_mode, as, &parts, code)) + parts.offset =3D NULL_TREE; + else + aff_inv->offset =3D 0; + } - move_fixed_address_to_symbol (&parts, aff_inv); - /* Base is fixed address and is moved to symbol part. */ - if (parts.symbol !=3D NULL_TREE && aff_combination_zero_p (aff_in= v)) - parts.base =3D NULL_TREE; + move_fixed_address_to_symbol (&parts, aff_inv); + /* Base is fixed address and is moved to symbol part. */ + if (parts.symbol !=3D NULL_TREE && aff_combination_zero_p (aff_inv)) + parts.base =3D NULL_TREE; - /* Addressing mode "symbol + base + index [<< scale] [+ offset]".= */ - if (parts.symbol !=3D NULL_TREE - && !valid_mem_ref_p (mem_mode, as, &parts, code)) - { - aff_combination_add_elt (aff_inv, parts.symbol, 1); - parts.symbol =3D NULL_TREE; - /* Reset SIMPLE_INV since symbol address needs to be computed - outside of address expression in this case. */ - simple_inv =3D false; - /* Symbol part is moved back to base part, it can't be NULL. = */ - parts.base =3D integer_one_node; - } + /* Addressing mode "symbol + base + index[<< scale] [+ offset]". */ + if (parts.symbol !=3D NULL_TREE + && !valid_mem_ref_p (mem_mode, as, &parts, code)) + { + aff_combination_add_elt (aff_inv, parts.symbol, 1); + parts.symbol =3D NULL_TREE; + /* Reset SIMPLE_INV since symbol address needs to be computed + outside of address expression in this case. */ + simple_inv =3D false; + /* Symbol part is moved back to base part, it can't be NULL. */ + parts.base =3D integer_one_node; } - else - parts.index =3D NULL_TREE; } else { @@ -4799,14 +4798,12 @@ get_address_cost (struct ivopts_data *data, struct = iv_use *use, if (stmt_after_increment (data->current_loop, cand, use->stmt)) ainc_offset +=3D ainc_step; - cost =3D get_address_cost_ainc (ainc_step, ainc_offset, + autoinc_cost =3D get_address_cost_ainc (ainc_step, ainc_offset, addr_mode, mem_mode, as, speed); - if (!cost.infinite_cost_p ()) - { - *can_autoinc =3D true; - return cost; - } - cost =3D no_cost; + if (!autoinc_cost.infinite_cost_p ()) + *can_autoinc =3D true; + else + autoinc_cost =3D no_cost; } if (!aff_combination_zero_p (aff_inv)) { @@ -4852,10 +4849,13 @@ get_address_cost (struct ivopts_data *data, struct = iv_use *use, cost +=3D var_cost; addr =3D addr_for_mem_ref (&parts, as, false); gcc_assert (memory_address_addr_space_p (mem_mode, addr, as)); - cost +=3D address_cost (addr, mem_mode, as, speed); + acost +=3D address_cost (addr, mem_mode, as, speed); if (parts.symbol !=3D NULL_TREE) cost.complexity +=3D 1; + /* var_present. */ + else if (!aff_combination_const_p (aff_inv)) + cost.complexity +=3D 1; /* Don't increase the complexity of adding a scaled index if it's the only kind of index that the target allows. */ if (parts.step !=3D NULL_TREE && ok_without_ratio_p) @@ -4865,6 +4865,7 @@ get_address_cost (struct ivopts_data *data, struct iv= _use *use, if (parts.offset !=3D NULL_TREE && !integer_zerop (parts.offset)) cost.complexity +=3D 1; + cost +=3D (can_autoinc && *can_autoinc) ? autoinc_cost : acost; return cost; } -- 2.34.1