Commit e588c7f
authored
[X86] Attempt to fold trunc(srl(load(p),amt) -> load(p+amt/8) (#165266)
As reported on #164853 - we only attempt to reduce shifted loads for constant shift amounts, but we could do more with non-constant values if value tracking can confirm basic alignments.
This patch determines if a truncated shifted load of scalar integer shifts by a byte aligned amount and replaces the non-constant shift amount with a pointer offset instead.
I had hoped to make this a generic DAG fold, but reduceLoadWidth isn't ready to be converted to a KnownBits value tracking mechanism, and other targets don't have complex address math like X86.
Fixes #1648531 parent 4678f16 commit e588c7f
File tree
5 files changed
+177
-1618
lines changed- llvm
- lib/Target/X86
- test/CodeGen/X86
5 files changed
+177
-1618
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54634 | 54634 | | |
54635 | 54635 | | |
54636 | 54636 | | |
| 54637 | + | |
54637 | 54638 | | |
54638 | 54639 | | |
54639 | 54640 | | |
| |||
54652 | 54653 | | |
54653 | 54654 | | |
54654 | 54655 | | |
| 54656 | + | |
| 54657 | + | |
| 54658 | + | |
| 54659 | + | |
| 54660 | + | |
| 54661 | + | |
| 54662 | + | |
| 54663 | + | |
| 54664 | + | |
| 54665 | + | |
| 54666 | + | |
| 54667 | + | |
| 54668 | + | |
| 54669 | + | |
| 54670 | + | |
| 54671 | + | |
| 54672 | + | |
| 54673 | + | |
| 54674 | + | |
| 54675 | + | |
| 54676 | + | |
| 54677 | + | |
| 54678 | + | |
| 54679 | + | |
| 54680 | + | |
| 54681 | + | |
| 54682 | + | |
| 54683 | + | |
| 54684 | + | |
| 54685 | + | |
| 54686 | + | |
| 54687 | + | |
| 54688 | + | |
54655 | 54689 | | |
54656 | 54690 | | |
54657 | 54691 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
660 | 660 | | |
661 | 661 | | |
662 | 662 | | |
663 | | - | |
664 | | - | |
| 663 | + | |
665 | 664 | | |
666 | 665 | | |
667 | 666 | | |
| |||
725 | 724 | | |
726 | 725 | | |
727 | 726 | | |
728 | | - | |
729 | | - | |
| 727 | + | |
730 | 728 | | |
731 | 729 | | |
732 | 730 | | |
| |||
0 commit comments