[all-commits] [llvm/llvm-project] b094c7: [flang] Avoid opaque pointer issue with character ...
jeanPerier via All-commits
all-commits at lists.llvm.org
Tue Jul 5 00:14:46 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b094c737cd85b8bf979c3cc998853b03a20d5c59
https://github.com/llvm/llvm-project/commit/b094c737cd85b8bf979c3cc998853b03a20d5c59
Author: Jean Perier <jperier at nvidia.com>
Date: 2022-07-05 (Tue, 05 Jul 2022)
Changed paths:
M flang/lib/Optimizer/CodeGen/CodeGen.cpp
M flang/test/Fir/embox.fir
Log Message:
-----------
[flang] Avoid opaque pointer issue with character array substring addressing
When addressing a substring of a character array, codegen emits two
GEPs: one for to compute the address of the base element, and a second
one to address the first characters from that element.
The first GEP still returns the LLVM array type (if the FIR array type could be
translated to an array type. Therefore) so zero
indexes must be added to the second GEP in this case to cover for the
Fortran array dimensions before inserting the susbtring offset index.
Surprisingly, the previous code worked ok when MLIR emits none opaque
pointers. But with opaque pointers, the two GEPs are folded in an
invalid GEP where the substring offset becomes an offset for the outer
array dimension.
Note that I tried to fix the issue by modifying the first GEP to return the
element type, but this still gave bad results (here something might be
wrong with opaque pointer in MLIR or LLVM).
Differential Revision: https://reviews.llvm.org/D129079
More information about the All-commits
mailing list