Lines Matching defs:elemental
1 //===- InlineElementals.cpp - Inline chained hlfir.elemental ops ----------===//
8 // Chained elemental operations like a + b + c can inline the first elemental
34 /// If the elemental has only two uses and those two are an apply operation and
37 getTwoUses(hlfir::ElementalOp elemental) {
38 mlir::Operation::user_range users = elemental->getUsers();
46 if (hlfir::elementalOpMustProduceTemp(elemental))
62 elemental.getRegion().back().back());
63 assert(yield && "hlfir.elemental should always end with a yield");
77 matchAndRewrite(hlfir::ElementalOp elemental,
80 getTwoUses(elemental);
83 elemental, "hlfir.elemental does not have two uses");
85 if (elemental.isOrdered()) {
86 // We can only inline the ordered elemental into a loop-like
90 return rewriter.notifyMatchFailure(elemental,
91 "hlfir.elemental is ordered");
95 assert(elemental.getRegion().hasOneBlock() &&
96 "expect elemental region to have one block");
98 fir::FirOpBuilder builder{rewriter, elemental.getOperation()};
101 elemental.getLoc(), builder, elemental, apply.getIndices());
103 // remove the old elemental and all of the bookkeeping
108 rewriter.eraseOp(elemental);
131 "failure in HLFIR elemental inlining");