[PATCH] D147539: [LV] Enable stride versioning to support Fortran IR

Peixin Qiao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 08:33:29 PDT 2023


peixin created this revision.
peixin added reviewers: fhahn, Ayal, david-arm, reames, paulwalker-arm, kiranchandramohan, Leporacanthicus, wwei.
peixin added projects: LLVM, All.
Herald added subscribers: StephenFan, hiraditya.
Herald added a reviewer: sscalpone.
peixin requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead.

The previous versioning assumes the access type is the Gep result type,
so the stride unit is always one. This is not true for Fortran IR
generated by current LLVM Flang. One example is as follows:

  %addr = getelementptr i8, ptr %array, i64 %offset
  %val = load float, ptr %addr

In this case, the stride unit is 4 bytes, and the stride should be
compared with 4. This patch enables stride versioning to support
Fortran IR by compare the access type and Gep result type.

With this patch, Fortran code with pointer array and assumed-shape
array can be stride versioned in LV.

Depends on 147378.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147539

Files:
  llvm/include/llvm/Analysis/LoopAccessAnalysis.h
  llvm/lib/Analysis/LoopAccessAnalysis.cpp
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/test/Transforms/LoopVectorize/stride-accesses-unit-check-fix.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147539.510814.patch
Type: text/x-patch
Size: 9427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230404/0f103db9/attachment.bin>


More information about the llvm-commits mailing list