Commit 60adde5
committed
[DAGCombiner] Lower dynamic insertelt chain
For an insertelt with dynamic indices, the default handling in
DAGTypeLegalizer and LegalizeDAG will reserve a stack slot for the
vector, lower the insertelt to a store, then load the modified vector
back into temporaries. The vector store and load may be legalized into a
sequence of smaller operations depending on the target. Let V = the
vector size and L = the length of a chain of insertelts with dynamic
indices. In the worse case, this chain will lower to O(VL) operations,
which can increase code size dramatically.
Instead, identify such chains, reserve one stack slot for the vector,
and lower all of the insertelts to stores at once. This requires only
O(V + L) operations. This change only affects the default lowering
behavior and still leaves targets to do their own thing.1 parent ca55c07 commit 60adde5
File tree
3 files changed
+449
-35
lines changed- llvm
- lib/CodeGen/SelectionDAG
- test/CodeGen
- NVPTX
- PowerPC
3 files changed
+449
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23476 | 23476 | | |
23477 | 23477 | | |
23478 | 23478 | | |
| 23479 | + | |
| 23480 | + | |
| 23481 | + | |
| 23482 | + | |
| 23483 | + | |
| 23484 | + | |
| 23485 | + | |
| 23486 | + | |
| 23487 | + | |
| 23488 | + | |
| 23489 | + | |
| 23490 | + | |
| 23491 | + | |
| 23492 | + | |
| 23493 | + | |
| 23494 | + | |
| 23495 | + | |
| 23496 | + | |
| 23497 | + | |
| 23498 | + | |
| 23499 | + | |
| 23500 | + | |
| 23501 | + | |
| 23502 | + | |
| 23503 | + | |
| 23504 | + | |
| 23505 | + | |
| 23506 | + | |
| 23507 | + | |
| 23508 | + | |
| 23509 | + | |
| 23510 | + | |
| 23511 | + | |
| 23512 | + | |
| 23513 | + | |
| 23514 | + | |
| 23515 | + | |
| 23516 | + | |
| 23517 | + | |
| 23518 | + | |
| 23519 | + | |
| 23520 | + | |
| 23521 | + | |
| 23522 | + | |
| 23523 | + | |
| 23524 | + | |
| 23525 | + | |
| 23526 | + | |
| 23527 | + | |
| 23528 | + | |
| 23529 | + | |
| 23530 | + | |
| 23531 | + | |
| 23532 | + | |
| 23533 | + | |
| 23534 | + | |
| 23535 | + | |
| 23536 | + | |
| 23537 | + | |
| 23538 | + | |
| 23539 | + | |
| 23540 | + | |
| 23541 | + | |
| 23542 | + | |
| 23543 | + | |
| 23544 | + | |
23479 | 23545 | | |
23480 | 23546 | | |
23481 | 23547 | | |
| |||
0 commit comments