|
32 | 32 | #include "flang/Lower/Todo.h"
|
33 | 33 | #include "flang/Optimizer/Builder/Character.h"
|
34 | 34 | #include "flang/Optimizer/Builder/Complex.h"
|
| 35 | +#include "flang/Optimizer/Builder/Runtime/Character.h" |
| 36 | +#include "flang/Optimizer/Builder/Runtime/RTBuilder.h" |
35 | 37 | #include "flang/Optimizer/Dialect/FIRAttr.h"
|
36 | 38 | #include "flang/Optimizer/Dialect/FIRDialect.h"
|
37 | 39 | #include "flang/Optimizer/Dialect/FIROpsSupport.h"
|
38 |
| -#include "flang/Optimizer/Builder/Runtime/Character.h" |
39 |
| -#include "flang/Optimizer/Builder/Runtime/RTBuilder.h" |
40 | 40 | #include "flang/Optimizer/Support/FatalError.h"
|
41 | 41 | #include "flang/Optimizer/Transforms/Factory.h"
|
42 | 42 | #include "flang/Semantics/expression.h"
|
@@ -4327,24 +4327,14 @@ class ArrayExprLowering {
|
4327 | 4327 | newIters.setIndexValue(dim, val);
|
4328 | 4328 | return newIters;
|
4329 | 4329 | };
|
4330 |
| - auto useInexactRange = [&]() { |
4331 |
| - // Get the range of the array in this dimension, [1:n:1]. |
4332 |
| - trips.push_back(one); |
4333 |
| - trips.push_back(getExtent(arrExt, sub.index())); |
4334 |
| - trips.push_back(one); |
4335 |
| - }; |
4336 |
| - if (const auto *sym = extractSubscriptSymbol(arrExpr)) { |
4337 |
| - auto symVal = symMap.lookupSymbol(*sym); |
4338 |
| - symVal.match( |
4339 |
| - [&](const fir::ArrayBoxValue &v) { |
4340 |
| - trips.push_back(getLBound(v, 0, one)); |
4341 |
| - trips.push_back(getUBound(v, 0, one)); |
4342 |
| - trips.push_back(one); |
4343 |
| - }, |
4344 |
| - [&](auto) { useInexactRange(); }); |
4345 |
| - } else { |
4346 |
| - useInexactRange(); |
4347 |
| - } |
| 4330 | + // Create a slice with the vector size so that the shape |
| 4331 | + // of array reference is correctly computed in later phase, |
| 4332 | + // even though this is not a triplet. |
| 4333 | + auto vectorSubscriptShape = getShape(arrLoad); |
| 4334 | + assert(vectorSubscriptShape.size() == 1); |
| 4335 | + trips.push_back(one); |
| 4336 | + trips.push_back(vectorSubscriptShape[0]); |
| 4337 | + trips.push_back(one); |
4348 | 4338 | } else {
|
4349 | 4339 | // A regular scalar index, which does not yield an array
|
4350 | 4340 | // section. Use a degenerate slice operation `(e:undef:undef)`
|
|
0 commit comments