Commit e42f860
authored
[flang][nfc] Support volatility in Fir ops (llvm#134858)
Part two of merging llvm#132486. Support volatility in fir ops. * Introduce a new operation fir.volatile_cast, whose only purpose is to add or take away the volatility of an SSA value's type. The types must be otherwise identical, and any other type conversions must be handled by fir.convert. fir.convert will give an error if the volatility of the inputs does not match, such that all changes to volatility must be handled explicitly through fir.volatile_cast. * Add memory effects to ops that read from or write to memory. The precedent for this comes from the LLVM dialect (feb7bea) where llvm.load/store ops with the volatile attribute report read/write effects to a generic memory resource. This change is similar in spirit but different in two ways: the volatility of an operation is determined by the type of its memref, not an attribute on the op, and the memory effects of a load- or store-like operation on a volatile reference type are reported against a particular memory resource, `VolatileMemoryResource`. This is so MLIR optimizations are able to reorder operations that are not volatile around operations that are, which we believe more precisely models LLVM's volatile memory semantics. @vzakhari suggested this in llvm#132486 citing LangRef. See https://llvm.org/docs/LangRef.html#volatile-memory-accesses Changes needed to generate IR with volatile types are not included in this change, so it should be non-functional, containing only the changes to Fir ops and op utilities that will be needed once we enable lowering to generate volatile types.1 parent aff1397 commit e42f860
File tree
9 files changed
+250
-25
lines changed- flang
- include/flang/Optimizer
- Builder
- Dialect
- lib
- Lower
- Optimizer
- Builder
- Dialect
- test/Fir
9 files changed
+250
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
400 | 405 | | |
401 | 406 | | |
402 | 407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
53 | 59 | | |
54 | 60 | | |
55 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
| 290 | + | |
290 | 291 | | |
291 | 292 | | |
292 | 293 | | |
| |||
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
305 | | - | |
| 306 | + | |
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
| |||
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
318 | | - | |
| 319 | + | |
| 320 | + | |
319 | 321 | | |
320 | 322 | | |
321 | 323 | | |
| |||
335 | 337 | | |
336 | 338 | | |
337 | 339 | | |
338 | | - | |
| 340 | + | |
339 | 341 | | |
340 | 342 | | |
341 | 343 | | |
| |||
348 | 350 | | |
349 | 351 | | |
350 | 352 | | |
351 | | - | |
| 353 | + | |
352 | 354 | | |
353 | 355 | | |
354 | 356 | | |
| |||
369 | 371 | | |
370 | 372 | | |
371 | 373 | | |
372 | | - | |
373 | | - | |
| 374 | + | |
| 375 | + | |
374 | 376 | | |
375 | 377 | | |
376 | 378 | | |
| |||
1373 | 1375 | | |
1374 | 1376 | | |
1375 | 1377 | | |
1376 | | - | |
| 1378 | + | |
| 1379 | + | |
1377 | 1380 | | |
1378 | 1381 | | |
1379 | 1382 | | |
| |||
1412 | 1415 | | |
1413 | 1416 | | |
1414 | 1417 | | |
1415 | | - | |
| 1418 | + | |
1416 | 1419 | | |
1417 | 1420 | | |
1418 | 1421 | | |
| |||
1624 | 1627 | | |
1625 | 1628 | | |
1626 | 1629 | | |
1627 | | - | |
| 1630 | + | |
1628 | 1631 | | |
1629 | 1632 | | |
1630 | 1633 | | |
| |||
1685 | 1688 | | |
1686 | 1689 | | |
1687 | 1690 | | |
1688 | | - | |
| 1691 | + | |
1689 | 1692 | | |
1690 | 1693 | | |
1691 | 1694 | | |
| |||
1714 | 1717 | | |
1715 | 1718 | | |
1716 | 1719 | | |
1717 | | - | |
| 1720 | + | |
1718 | 1721 | | |
1719 | 1722 | | |
1720 | 1723 | | |
| |||
2752 | 2755 | | |
2753 | 2756 | | |
2754 | 2757 | | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
2755 | 2774 | | |
2756 | 2775 | | |
2757 | 2776 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
25 | 38 | | |
26 | 39 | | |
27 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
419 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
420 | 425 | | |
421 | 426 | | |
422 | 427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
580 | 591 | | |
581 | 592 | | |
582 | 593 | | |
| |||
739 | 750 | | |
740 | 751 | | |
741 | 752 | | |
| 753 | + | |
742 | 754 | | |
743 | 755 | | |
744 | 756 | | |
745 | 757 | | |
746 | 758 | | |
747 | 759 | | |
748 | | - | |
| 760 | + | |
749 | 761 | | |
750 | 762 | | |
751 | 763 | | |
752 | | - | |
| 764 | + | |
753 | 765 | | |
754 | | - | |
| 766 | + | |
755 | 767 | | |
756 | 768 | | |
757 | 769 | | |
| |||
0 commit comments