Commit 2a95fe4
authored
[Flang] Allow Intrinsic simpification with min/maxloc dim and scalar result (#81619)
This makes an adjustment to the existing fir minloc/maxloc generation
code to handle functions with a dim=1 that produce a scalar result. This
should allow us to get the same benefits as the existing generated
minmax reductions.
This is a recommit of #76194 with an extra alteration to the end of
genRuntimeMinMaxlocBody to make sure we convert the output array to the
correct type (a `box<heap<i32>>`, not `box<heap<array<1xi32>>>`) to
prevent writing the wrong type of box into it. This still allocates the
data as a `array<1xi32>`, converting it into a i32 assuming that is
safe. An alternative would be to allocate the data as a i32 and change
more of the accesses to it throughout genRuntimeMinMaxlocBody.1 parent ca827d5 commit 2a95fe4
File tree
2 files changed
+92
-27
lines changed- flang
- lib/Optimizer/Transforms
- test/Transforms
2 files changed
+92
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
659 | | - | |
| 659 | + | |
660 | 660 | | |
661 | 661 | | |
662 | 662 | | |
| |||
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
871 | 882 | | |
872 | 883 | | |
873 | 884 | | |
| |||
1146 | 1157 | | |
1147 | 1158 | | |
1148 | 1159 | | |
1149 | | - | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
1150 | 1164 | | |
1151 | 1165 | | |
1152 | 1166 | | |
1153 | | - | |
| 1167 | + | |
1154 | 1168 | | |
1155 | 1169 | | |
1156 | 1170 | | |
| |||
1159 | 1173 | | |
1160 | 1174 | | |
1161 | 1175 | | |
1162 | | - | |
1163 | | - | |
1164 | 1176 | | |
1165 | | - | |
| 1177 | + | |
1166 | 1178 | | |
1167 | 1179 | | |
1168 | 1180 | | |
| |||
1203 | 1215 | | |
1204 | 1216 | | |
1205 | 1217 | | |
| 1218 | + | |
| 1219 | + | |
1206 | 1220 | | |
1207 | 1221 | | |
1208 | 1222 | | |
1209 | 1223 | | |
1210 | 1224 | | |
1211 | 1225 | | |
1212 | | - | |
1213 | | - | |
| 1226 | + | |
| 1227 | + | |
1214 | 1228 | | |
1215 | | - | |
| 1229 | + | |
1216 | 1230 | | |
1217 | 1231 | | |
1218 | 1232 | | |
1219 | 1233 | | |
1220 | 1234 | | |
1221 | | - | |
| 1235 | + | |
1222 | 1236 | | |
1223 | 1237 | | |
1224 | 1238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2098 | 2098 | | |
2099 | 2099 | | |
2100 | 2100 | | |
2101 | | - | |
| 2101 | + | |
2102 | 2102 | | |
2103 | | - | |
| 2103 | + | |
2104 | 2104 | | |
2105 | 2105 | | |
2106 | 2106 | | |
2107 | | - | |
| 2107 | + | |
2108 | 2108 | | |
2109 | 2109 | | |
2110 | 2110 | | |
| |||
2139 | 2139 | | |
2140 | 2140 | | |
2141 | 2141 | | |
2142 | | - | |
| 2142 | + | |
2143 | 2143 | | |
2144 | | - | |
2145 | | - | |
2146 | | - | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
2147 | 2198 | | |
2148 | 2199 | | |
2149 | 2200 | | |
| |||
0 commit comments