[all-commits] [llvm/llvm-project] fe4d50: [flang] fix unsafe memory access using mlir::Value...
madanial0 via All-commits
all-commits at lists.llvm.org
Thu Jan 18 07:18:05 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: fe4d502524be85e39dd5e2726abaca2231fb222b
https://github.com/llvm/llvm-project/commit/fe4d502524be85e39dd5e2726abaca2231fb222b
Author: madanial0 <118996571+madanial0 at users.noreply.github.com>
Date: 2024-01-18 (Thu, 18 Jan 2024)
Changed paths:
M flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp
M flang/test/HLFIR/simplify-hlfir-intrinsics.fir
Log Message:
-----------
[flang] fix unsafe memory access using mlir::ValueRange (#78435)
When running the `flang/test/HLFIR/simplify-hlfir-intrinsics.fir` test
case on AIX we encounter issues building op as they are not found in the
mlir context:
```
LLVM ERROR: Building op `arith.subi` but it isn't known in this MLIRContext: the dialect may not be loaded or this operation hasn't been added by the dialect. See also https://mlir.llvm.org/getting_started/Faq/#registered-loaded-dependent-whats-up-with-dialects-management
LLVM ERROR: Building op `hlfir.yield_element` but it isn't known in this MLIRContext: the dialect may not be loaded or this operation hasn't been added by the dialect. See also https://mlir.llvm.org/getting_started/Faq/#registered-loaded-dependent-whats-up-with-dialects-management
LLVM ERROR: Building op `hlfir.yield_element` but it isn't known in this MLIRContext: the dialect may not be loaded or this operation hasn't been added by the dialect. See also https://mlir.llvm.org/getting_started/Faq/#registered-loaded-dependent-whats-up-with-dialects-management
```
The issue is caused by the "Merge disjoint stack slots" pass and the
error is not present if the source is built with `-mllvm
--no-stack-coloring`
Thanks to investigation by @stefanp-ibm we found that "the
initializer_list {inputIndices[1], inputIndices[0]} has a lifetime that
only exists for the range of the constructor for ValueRange. Once we get
to stack coloring we merge the stack slot for that element with another
stack slot and then it gets overwritten which corrupts
transposedIndices"
The changes below prevents the corruption of transposedIndices and
passes the test case.
Co-authored-by: Mark Danial <mark.danial at ibm.com>
More information about the All-commits
mailing list