Commit 484f1b0
Fix instruction order issue in scalarizer (#5001)
When scalarize shuffle inst which has extract element as the input element,
create clone before the shuffle instead of after.
Because later when replace the shuffle, new vector will be inserted before the shuffle.
The elt define will be after its use if inserted before the shuffle earlier.
Like
%[[B:.+]] = load <2 x float>, <2 x float>* %b, align 4 %[[X:.+]] = insertelement <4 x float> undef, float %[[BX0]], i32 0
%[[Y:.+]] = insertelement <4 x float> %[[X]], float %[[BY0]], i32 1
%[[Z:.+]] = insertelement <4 x float> %[[Y]], float %[[BX1]], i32 2
%[[W:.+]] = insertelement <4 x float> %[[Z]], float %[[BY1]], i32 3 %[[BX0:.+]] = extractelement <2 x float> %[[B]], i32 0
%[[BY0:.+]] = extractelement <2 x float> %[[B]], i32 1
%[[BX1:.+]] = extractelement <2 x float> %[[B]], i32 0
%[[BY1:.+]] = extractelement <2 x float> %[[B]], i32 1
(cherry picked from commit b3dedc9)1 parent d9d83d0 commit 484f1b0
2 files changed
Lines changed: 34 additions & 1 deletion
File tree
- lib/Transforms/Scalar
- tools/clang/test/HLSLFileCheckLit/passes/llvm/scalarizer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
633 | 633 | | |
634 | 634 | | |
635 | 635 | | |
636 | | - | |
| 636 | + | |
637 | 637 | | |
638 | 638 | | |
639 | 639 | | |
| |||
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
0 commit comments