Commit e21bc1b
Fix temporarily unparented insts wrecking stuff in specializeFunctionCalls (#9718)
Closes #9717. The fix was to just implement the (extremely on-point)
TODO by @tangent-vector 😄
What was happening here was that `generateSpecializedFunc` was replacing
parameters with new instructions that didn't have a parent. This in turn
caused the `emitIntrinsicInst` call in `cloneInstAndOperands` to
mistakenly make hoistable insts global when depending on those replaced
parameters.
Afterwards, the function gets cloned due to the
`specializeFuncsForBufferLoadArgs` pass. At this point, the clone is
already busted; it skips cloning a "global" inst (the mistakenly hoisted
inst) that references a parameter of the original function, leading to
#9717 (comment).
Later, this "global" load gets "inlined" back into the function again
due to the addition of `kIROp_Load` to `isInlinableGlobalInst` in #8686.
In the cloned function, this causes it to reference a parameter of the
original function and ultimately causes the issue in question.
What a chain reaction!
---------
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>1 parent 812dc34 commit e21bc1b
File tree
2 files changed
+42
-30
lines changed- source/slang
- tests/bugs
2 files changed
+42
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
689 | 694 | | |
690 | 695 | | |
691 | 696 | | |
| |||
886 | 891 | | |
887 | 892 | | |
888 | 893 | | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
| 894 | + | |
902 | 895 | | |
903 | 896 | | |
904 | 897 | | |
905 | 898 | | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | 899 | | |
915 | 900 | | |
916 | 901 | | |
| |||
928 | 913 | | |
929 | 914 | | |
930 | 915 | | |
931 | | - | |
| 916 | + | |
932 | 917 | | |
933 | 918 | | |
934 | 919 | | |
935 | 920 | | |
936 | | - | |
937 | | - | |
938 | 921 | | |
939 | 922 | | |
940 | 923 | | |
| |||
943 | 926 | | |
944 | 927 | | |
945 | 928 | | |
946 | | - | |
| 929 | + | |
947 | 930 | | |
948 | | - | |
949 | 931 | | |
950 | 932 | | |
951 | 933 | | |
| |||
958 | 940 | | |
959 | 941 | | |
960 | 942 | | |
961 | | - | |
| 943 | + | |
962 | 944 | | |
963 | 945 | | |
964 | 946 | | |
965 | 947 | | |
966 | 948 | | |
967 | 949 | | |
968 | | - | |
969 | 950 | | |
970 | 951 | | |
971 | 952 | | |
| |||
1030 | 1011 | | |
1031 | 1012 | | |
1032 | 1013 | | |
| 1014 | + | |
1033 | 1015 | | |
1034 | 1016 | | |
1035 | 1017 | | |
| |||
1107 | 1089 | | |
1108 | 1090 | | |
1109 | 1091 | | |
1110 | | - | |
| 1092 | + | |
1111 | 1093 | | |
| 1094 | + | |
1112 | 1095 | | |
| 1096 | + | |
1113 | 1097 | | |
1114 | 1098 | | |
| 1099 | + | |
| 1100 | + | |
1115 | 1101 | | |
1116 | 1102 | | |
1117 | 1103 | | |
| |||
| 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 | + | |
0 commit comments