[flang-commits] [flang] 1f74f5f - [flang] Fix flang build after #83132 (#83253)
via flang-commits
flang-commits at lists.llvm.org
Wed Feb 28 05:05:10 PST 2024
Author: Matthias Springer
Date: 2024-02-28T14:05:06+01:00
New Revision: 1f74f5f48bc9e1091602163ac925c807d70706e1
URL: https://github.com/llvm/llvm-project/commit/1f74f5f48bc9e1091602163ac925c807d70706e1
DIFF: https://github.com/llvm/llvm-project/commit/1f74f5f48bc9e1091602163ac925c807d70706e1.diff
LOG: [flang] Fix flang build after #83132 (#83253)
This fix is a temporary workaround. `LowerHLFIRIntrinsics.cpp` should be
using the greedy pattern rewriter or a manual IR traversal. All patterns
in this file are rewrite patterns. The test failure was caused by
`replaceAllUsesWith`, which is not supported by the dialect conversion;
additional asserts were added recently to prevent incorrect API usage.
These trigger now.
Alternatively, turning the patterns into conversion patterns and
specifying a type converter may work.
Failing test case:
`Fortran/gfortran/regression/gfortran-regression-compile-regression__inline_matmul_14_f90.test`
Added:
Modified:
flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp
index 314e4264c17e83..377cc44392028f 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp
@@ -176,7 +176,14 @@ class HlfirIntrinsicConversion : public mlir::OpRewritePattern<OP> {
rewriter.eraseOp(use);
}
}
- rewriter.replaceAllUsesWith(op->getResults(), {base});
+ // TODO: This entire pass should be a greedy pattern rewrite or a manual
+ // IR traversal. A dialect conversion cannot be used here because
+ // `replaceAllUsesWith` is not supported. Similarly, `replaceOp` is not
+ // suitable because "op->getResult(0)" and "base" can have
diff erent types.
+ // In such a case, the dialect conversion will attempt to convert the type,
+ // but no type converter is specified in this pass. Also note that all
+ // patterns in this pass are actually rewrite patterns.
+ op->getResult(0).replaceAllUsesWith(base);
rewriter.replaceOp(op, base);
}
};
More information about the flang-commits
mailing list