[all-commits] [llvm/llvm-project] be5747: [flang] Fixed global name creation for literal con...
Slava Zakharin via All-commits
all-commits at lists.llvm.org
Fri May 12 13:40:36 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: be5747e516937df6436c9abb8059b6e471c02226
https://github.com/llvm/llvm-project/commit/be5747e516937df6436c9abb8059b6e471c02226
Author: Slava Zakharin <szakharin at nvidia.com>
Date: 2023-05-12 (Fri, 12 May 2023)
Changed paths:
M flang/include/flang/Evaluate/constant.h
M flang/include/flang/Lower/AbstractConverter.h
M flang/include/flang/Lower/IterationSpace.h
M flang/include/flang/Lower/Mangler.h
M flang/include/flang/Lower/Support/Utils.h
M flang/lib/Lower/Bridge.cpp
M flang/lib/Lower/ConvertConstant.cpp
M flang/lib/Lower/IterationSpace.cpp
M flang/lib/Lower/Mangler.cpp
M flang/test/Lower/array-character.f90
M flang/test/Lower/array-constructor-1.f90
M flang/test/Lower/array-constructor-2.f90
M flang/test/Lower/array-expression-slice-1.f90
M flang/test/Lower/constant-literal-mangling.f90
Log Message:
-----------
[flang] Fixed global name creation for literal constants.
The global names were created using a hash based on the address
of std::vector::data address. Since the memory may be reused
by different std::vector's, this may cause non-equivalent
constant expressions to map to the same name. This is what is happening
in the modified flang/test/Lower/constant-literal-mangling.f90 test.
I changed the name creation to use a map between the constant expressions
and corresponding unique names. The uniquing is done using a name counter
in FirConverter. The effect of this change is that the equivalent
constant expressions are now mapped to the same global, and the naming
is "stable" (i.e. it does not change from compilation to compilation).
Though, the issue is not HLFIR specific it was affecting several tests
when using HLFIR lowering.
Differential Revision: https://reviews.llvm.org/D150380
More information about the All-commits
mailing list