[flang-commits] [flang] [flang] AliasAnalysis: Handle fir.load on hlfir.designate (PR #127107)

Joel E. Denny via flang-commits flang-commits at lists.llvm.org
Mon Feb 17 13:00:32 PST 2025


jdenny-ornl wrote:

> Would you not be getting better results commenting these 2 lines out?
> 
> ```
>             else if (auto allocOp =
>                          def.template getDefiningOp<fir::AllocaOp>()) {
>               //v = def;
>               //defOp = v.getDefiningOp();
>               type = SourceKind::Allocate;
> ```

I've just added new tests for allocas whose results should be MayAlias (or possibly even MustAlias with more analysis) but become NoAlias if I apply that suggested change.  For completeness, I also added similar tests for dummy args and global variables, but that suggested change only affects allocas of course.

For a dummy arg or global variable, the source of a load from it is the dummy arg or the global variable itself.  That suggested change adjusts the alloca case so the source is the load instead.  That means two different loads from the same alloca have different sources, and so we don't detect aliasing as we should.

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


More information about the flang-commits mailing list