[flang-commits] [flang] [flang] add nsw to operations in subscripts (PR #110060)

via flang-commits flang-commits at lists.llvm.org
Thu Sep 26 01:37:53 PDT 2024


https://github.com/jeanPerier commented:

Thank you very much for taking the time to build this carefully crafted solution.

I am wondering if it would be OK to do like for the fastmath flags inside the builder directly [here](https://github.com/llvm/llvm-project/blob/57bed5cd63b5d23ca821be09b4e593646cd84146/flang/include/flang/Optimizer/Builder/FIRBuilder.h#L79) using the `ArithIntegerOverflowFlagsInterface` so that this solution would easily usable in other contexts in the future and better enclosed in the builder.

But it would add the flags on more arith ops generated by lowering outside of the contexts of evaluate::AddIOp, SubIOp, and MulIOp lowering. I would tend to say these compiler generated ops in lowering are not expected to overflow, but it is hard to audit,  so I understand why you took the current approach which is more conservative. I am mostly writing that here to double check with other reviewers and document the choice for git blamers like me.

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


More information about the flang-commits mailing list