Skip to content

Commit

Permalink
[flang] Fix flang build after #83132 (#83253)
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
matthias-springer committed Feb 28, 2024
1 parent 27b297b commit 1f74f5f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 different 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);
}
};
Expand Down

0 comments on commit 1f74f5f

Please sign in to comment.