[flang-commits] [flang] [Flang] Extracting internal constants from scalar literals (PR #73829)

Mats Petersson via flang-commits flang-commits at lists.llvm.org
Mon Jun 17 12:57:31 PDT 2024


Leporacanthicus wrote:

> Conforming or not, code that is reasonably portable today should also work with f18 with default options without source changes. This case is kind of on the edge.

This particular example works fine (as in prints 1 twice) with these changes - because the write to x gets optimized away, I think. 

I'm not sure if there are more complex cases where it doesn't work quite that well - I have a hard time coming up with a case where this pass actually goes wrong. Your comments makes me wonder what we should do for that - the only plausible solution I can think of is to basically not do this unless we the compiler can "see" the source of the code being called - and it's precisely the case of the callee being in a different module that we're trying to make better here.

Any thoughts? 

https://github.com/llvm/llvm-project/pull/73829


More information about the flang-commits mailing list