Commit eb5e1ea
committed
[MLIR][LLVMIR] Use TargetFolder when creating globals
The LLVM dialect lowers globals using IRBuilder, relying on it
creating constant expressions where possible. As we remove support
for more constant expressions (per https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179), this can cause issues for cases where
the constant expression is no longer supported, and the operand
cannot be constant folded without DataLayout being available. In
particular, I ran into this issue with flang and the removal of
mul constant expressions.
Address this by using TargetFolder when creating globals, which
will perform DL-aware constant folding. I think it would make
sense to also do this in general, but I'm starting with globals
where not doing this can result in translation failures.
Ideally, globals with these problematic expressions would never be
generated in the first place, but there has been essentially no
movemenet on fixing this (#96047).1 parent a058741 commit eb5e1ea
File tree
6 files changed
+14
-9
lines changed- flang/test/Fir
- mlir
- lib/Target/LLVMIR
- test/Target/LLVMIR
6 files changed
+14
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
1171 | 1172 | | |
1172 | 1173 | | |
1173 | 1174 | | |
1174 | | - | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1175 | 1178 | | |
1176 | 1179 | | |
1177 | 1180 | | |
| |||
1282 | 1285 | | |
1283 | 1286 | | |
1284 | 1287 | | |
1285 | | - | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
1286 | 1291 | | |
1287 | 1292 | | |
1288 | 1293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
0 commit comments