Luke Lau
742fb8b5c7
[DAGCombine] Fold (store (insert_elt (load p)) x p) -> (store x)
...
If we have a store of a load with no other uses in between it, it's
considered dead and is removed. So sometimes when legalizing a fixed
length vector store of an insert, we end up producing better code
through scalarization than without.
An example is the follow below:
%a = load <4 x i64>, ptr %x
%b = insertelement <4 x i64> %a, i64 %y, i32 2
store <4 x i64> %b, ptr %x
If this is scalarized, then DAGCombine successfully removes 3 of the 4
stores which are considered dead, and on RISC-V we get:
sd a1, 16(a0)
However if we make the vector type legal (-mattr=+v), then we lose the
optimisation because we don't scalarize it.
This patch attempts to recover the optimisation for vectors by
identifying patterns where we store a load with a single insert
inbetween, replacing it with a scalar store of the inserted element.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D152276
2023-06-28 22:45:04 +01:00
..
2022-09-19 10:12:15 -07:00
2021-12-30 12:47:30 -08:00
2022-10-12 15:31:28 -07:00
2022-10-12 15:31:28 -07:00
2022-12-19 12:53:32 +01:00
2021-12-29 10:18:21 -08:00
2021-12-29 10:18:21 -08:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-01-04 11:03:51 -08:00
2022-01-04 11:03:51 -08:00
2022-12-19 12:53:32 +01:00
2022-11-24 18:10:42 -08:00
2021-12-29 06:52:24 -08:00
2022-10-18 09:49:17 -07:00
2023-06-28 22:45:04 +01:00
2022-12-19 12:53:32 +01:00
2021-12-29 06:52:24 -08:00
2022-12-19 12:53:32 +01:00
2022-11-29 14:19:29 -08:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2021-12-30 07:57:11 -08:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2023-02-16 09:57:58 -08:00
2022-11-01 08:40:20 -07:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2023-05-17 10:42:58 -07:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2023-02-21 12:56:33 -08:00
2022-12-05 12:40:08 -08:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2023-06-13 09:14:37 +00:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2021-12-30 12:17:22 -08:00
2023-06-13 09:14:37 +00:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-14 10:25:34 -08:00
2022-11-12 08:46:27 -08:00
2022-11-29 14:19:29 -08:00
2022-10-12 15:31:28 -07:00
2022-10-12 15:31:28 -07:00
2022-11-29 14:19:29 -08:00
2022-11-29 14:19:29 -08:00
2021-12-29 09:01:07 -08:00
2022-12-19 12:53:32 +01:00
2023-05-23 07:45:12 -07:00
2023-05-24 06:06:25 -07:00
2022-12-19 12:53:32 +01:00
2023-05-27 09:11:09 -07:00
2023-05-17 04:33:53 -07:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2023-03-17 08:13:49 -07:00
2023-06-16 13:29:19 -07:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2023-05-17 04:33:53 -07:00
2023-05-24 06:06:25 -07:00
2023-05-24 06:06:25 -07:00
2022-10-19 14:23:39 -07:00
2022-12-19 12:53:32 +01:00
2021-12-30 12:17:22 -08:00
2022-12-19 12:53:32 +01:00
2022-10-22 15:08:27 -07:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00
2022-12-19 12:53:32 +01:00