David Sherwood
4afeda9157
[LoopVectorize] Simplify scalar cost calculation in getInstructionCost
...
This patch simplifies the calculation of certain costs in
getInstructionCost when isScalarAfterVectorization() returns a true value.
There are a few places where we multiply a cost by a number N, i.e.
unsigned N = isScalarAfterVectorization(I, VF) ? VF.getKnownMinValue() : 1;
return N * TTI.getArithmeticInstrCost(...
After some investigation it seems that there are only these cases that occur
in practice:
1. VF is a scalar, in which case N = 1.
2. VF is a vector. We can only get here if: a) the instruction is a
GEP/bitcast/PHI with scalar uses, or b) this is an update to an induction
variable that remains scalar.
I have changed the code so that N is assumed to always be 1. For GEPs
the cost is always 0, since this is calculated later on as part of the
load/store cost. PHI nodes are costed separately and were never previously
multiplied by VF. For all other cases I have added an assert that none of
the users needs scalarising, which didn't fire in any unit tests.
Only one test required fixing and I believe the original cost for the scalar
add instruction to have been wrong, since only one copy remains after
vectorisation.
I have also added a new test for the case when a pointer PHI feeds directly
into a store that will be scalarised as we were previously never testing it.
Differential Revision: https://reviews.llvm.org/D99718
2021-04-27 15:26:15 +01:00
..
2021-04-27 15:26:15 +01:00
2021-02-12 08:13:50 -05:00
2021-04-08 10:39:47 +01:00
2021-02-01 12:14:59 +00:00
2021-03-23 15:32:23 +00:00
2021-03-24 11:14:14 -07:00
2021-01-06 11:22:50 +09:00
2020-11-06 11:12:10 +01:00
2021-04-22 15:05:54 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-06-14 20:55:59 +01:00
2019-04-17 04:52:47 +00:00
2021-04-01 11:55:41 -04:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-06-26 20:41:37 -07:00
2019-04-17 04:52:47 +00:00
2020-10-31 00:25:32 -07:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2021-01-06 11:22:50 +09:00
2020-12-28 10:13:28 -08:00
2019-04-17 04:52:47 +00:00
2019-12-24 16:27:51 -08:00
2020-11-24 15:12:54 +02:00
2021-02-12 08:13:50 -05:00
2019-04-17 04:52:47 +00:00
2019-12-24 15:57:33 -08:00
2019-12-24 15:57:33 -08:00
2019-12-24 15:57:33 -08:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-12-30 04:21:04 +09:00
2021-02-02 08:09:39 +02:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-04-20 11:55:49 -07:00
2020-04-20 11:55:49 -07:00
2021-03-05 09:57:56 +00:00
2020-05-13 13:50:09 +01:00
2021-03-06 21:52:46 +03:00
2019-11-24 21:21:55 +00:00
2021-03-06 21:52:46 +03:00
2021-02-12 08:13:50 -05:00
2021-02-12 08:13:50 -05:00
2021-03-18 08:11:22 -04:00
2021-02-15 13:47:05 +00:00
2020-11-23 20:00:58 -05:00
2019-05-30 18:19:35 +00:00
2020-10-08 08:28:58 +01:00
2019-04-17 04:52:47 +00:00
2020-06-26 20:41:37 -07:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-12-17 01:03:49 +03:00
2019-09-09 20:54:13 +00:00
2019-04-17 04:52:47 +00:00
2021-03-23 09:50:14 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2021-02-14 21:12:34 +09:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2021-02-14 21:12:34 +09:00
2020-12-17 01:03:49 +03:00
2021-03-06 21:52:46 +03:00
2021-02-14 21:12:34 +09:00
2019-12-24 15:57:33 -08:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-12-30 04:21:04 +09:00
2021-02-12 08:13:50 -05:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-12-30 04:21:04 +09:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-12-30 04:21:04 +09:00
2019-11-09 20:52:25 +02:00
2021-04-11 18:08:08 +03:00
2019-04-17 04:52:47 +00:00
2020-07-29 10:23:07 -07:00
2021-03-06 21:52:46 +03:00
2021-03-17 17:03:47 +01:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2021-03-06 21:52:46 +03:00
2020-12-28 10:13:28 -08:00
2020-12-07 21:48:21 -08:00
2019-04-17 04:52:47 +00:00
2019-04-22 09:53:26 +00:00
2020-08-26 16:55:25 +01:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2021-01-08 10:49:44 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2021-02-15 13:47:05 +00:00
2021-02-17 21:37:08 -05:00
2019-04-17 04:52:47 +00:00
2020-06-26 20:41:37 -07:00
2021-01-20 11:48:48 +00:00
2020-12-30 04:21:04 +09:00
2020-12-02 13:23:43 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-12-20 14:48:53 +02:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-07-24 12:14:27 -07:00
2020-07-24 12:14:27 -07:00
2021-01-19 20:09:42 +01:00
2019-08-06 06:08:48 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-06-17 17:20:08 +00:00
2020-07-30 19:40:29 -07:00
2019-04-17 04:52:47 +00:00
2019-12-20 14:48:53 +02:00
2019-04-25 04:49:48 +00:00
2021-01-08 10:49:44 +00:00
2020-12-02 10:09:56 -05:00
2021-01-08 10:49:44 +00:00
2021-01-21 21:08:54 -08:00
2020-12-30 04:21:04 +09:00
2021-02-22 09:44:25 +00:00
2021-02-22 09:44:25 +00:00
2021-02-22 09:44:25 +00:00
2019-04-17 04:52:47 +00:00
2020-12-07 21:48:21 -08:00
2019-04-17 04:52:47 +00:00
2021-03-13 16:05:34 +03:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-07-07 22:12:01 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2021-04-09 10:01:57 +01:00
2019-04-17 04:52:47 +00:00
2020-05-13 13:50:09 +01:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-05-08 18:50:07 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2021-01-06 11:22:50 +09:00
2019-09-03 09:33:55 +00:00
2021-01-06 11:22:50 +09:00
2021-04-20 21:29:21 +03:00
2020-04-15 10:39:07 +03:00
2020-06-09 18:30:56 +00:00
2020-12-30 04:21:04 +09:00
2021-03-01 10:48:04 +00:00
2021-02-14 21:12:34 +09:00
2019-04-17 04:52:47 +00:00
2020-06-26 20:41:37 -07:00
2019-04-17 04:52:47 +00:00
2019-06-12 13:15:59 +00:00
2021-02-14 21:12:34 +09:00
2021-02-12 08:13:50 -05:00
2021-02-14 21:12:34 +09:00
2020-10-11 16:58:34 +01:00
2021-02-12 08:13:50 -05:00
2021-02-19 14:01:57 -05:00
2019-12-20 14:48:53 +02:00
2021-02-12 08:13:50 -05:00
2021-01-01 13:54:41 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-06-26 20:41:37 -07:00
2020-05-13 13:50:09 +01:00
2020-10-07 18:57:07 +01:00
2019-12-24 15:57:33 -08:00
2019-04-17 04:52:47 +00:00
2020-11-16 14:48:09 -05:00
2021-03-01 10:48:04 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2021-01-08 10:49:44 +00:00
2021-01-08 10:49:44 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-12-24 15:57:33 -08:00
2021-02-12 08:13:50 -05:00
2019-04-17 04:52:47 +00:00
2021-02-24 10:36:02 +00:00
2021-03-01 10:48:04 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-06-26 20:41:37 -07:00
2019-04-17 04:52:47 +00:00
2020-08-26 16:55:25 +01:00
2020-07-30 14:28:08 +01:00
2020-12-17 01:03:49 +03:00
2020-10-31 00:25:32 -07:00
2019-04-17 04:52:47 +00:00
2021-03-12 13:31:48 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-06-19 10:50:47 +00:00
2020-12-01 11:30:34 +00:00
2019-04-17 04:52:47 +00:00
2020-08-26 16:55:25 +01:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2019-04-17 04:52:47 +00:00
2020-12-30 04:21:04 +09:00
2020-05-13 13:50:09 +01:00
2020-12-17 01:03:49 +03:00
2021-04-27 13:49:32 +01:00
2020-04-30 15:47:21 -04:00
2020-06-26 20:41:37 -07:00
2019-04-17 04:52:47 +00:00
2021-03-19 10:50:12 -07:00
2020-06-12 10:31:18 +01:00
2021-03-23 09:50:14 +00:00
2019-04-17 04:52:47 +00:00
2021-02-22 09:44:25 +00:00
2021-03-06 21:59:52 +00:00
2021-03-10 20:59:53 +00:00
2019-06-12 13:15:59 +00:00
2019-04-17 04:52:47 +00:00