Lines Matching refs:rewriter

29 static void createOpI(PatternRewriter &rewriter, Location loc, Value input) {  in createOpI()  argument
30 rewriter.create<OpI>(loc, input); in createOpI()
33 static void handleNoResultOp(PatternRewriter &rewriter, in handleNoResultOp() argument
36 rewriter.create<OpSymbolBindingB>(op.getLoc(), op.getOperand().getType(), in handleNoResultOp()
59 static Attribute opMTest(PatternRewriter &rewriter, Value val) { in opMTest() argument
61 return rewriter.getIntegerAttr(rewriter.getIntegerType(32), i); in opMTest()
88 PatternRewriter &rewriter) const override { in matchAndRewrite()
96 rewriter, op->getLoc(), rewriter.getIntegerType(32), op->getOperand(0), in matchAndRewrite()
97 rewriter.getI32IntegerAttr(0)); in matchAndRewrite()
99 rewriter.replaceOp(op, result); in matchAndRewrite()
114 PatternRewriter &rewriter) const override { in matchAndRewrite()
117 rewriter.setInsertionPointToStart(op->getBlock()); in matchAndRewrite()
119 auto constOp = rewriter.create<arith::ConstantOp>( in matchAndRewrite()
120 op.getLoc(), rewriter.getBoolAttr(true)); in matchAndRewrite()
121 rewriter.replaceOpWithNewOp<TestCastOp>(op, rewriter.getI32Type(), in matchAndRewrite()
137 PatternRewriter &rewriter) const override { in matchAndRewrite()
145 rewriter.replaceOp(op, operand->getOperand(1)); in matchAndRewrite()
221 PatternRewriter &rewriter) const override { in matchAndRewrite()
226 rewriter.create(op->getLoc(), op->getName().getIdentifier(), in matchAndRewrite()
228 op->setAttr("skip", rewriter.getBoolAttr(true)); in matchAndRewrite()
229 newOp->setAttr("skip", rewriter.getBoolAttr(true)); in matchAndRewrite()
242 PatternRewriter &rewriter) const override { in matchAndRewrite()
244 rewriter.create(op->getLoc(), op->getName().getIdentifier(), in matchAndRewrite()
246 rewriter.replaceOp(op, newOp->getResults()); in matchAndRewrite()
257 PatternRewriter &rewriter) const override { in matchAndRewrite()
258 rewriter.eraseOp(op); in matchAndRewrite()
394 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
399 rewriter.cloneRegionBefore(opRegion, parentRegion, parentRegion.end()); in matchAndRewrite()
401 rewriter.inlineRegionBefore(opRegion, parentRegion, parentRegion.end()); in matchAndRewrite()
405 rewriter.eraseBlock(&opRegion.front()); in matchAndRewrite()
409 rewriter.eraseOp(op); in matchAndRewrite()
420 PatternRewriter &rewriter) const final { in matchAndRewrite()
424 auto *regionOp = rewriter.create(newRegion); in matchAndRewrite()
425 auto *entryBlock = rewriter.createBlock(&regionOp->getRegion(0)); in matchAndRewrite()
426 entryBlock->addArgument(rewriter.getIntegerType(64), in matchAndRewrite()
427 rewriter.getUnknownLoc()); in matchAndRewrite()
430 rewriter.create<ILLegalOpF>(op->getLoc(), rewriter.getIntegerType(32)); in matchAndRewrite()
431 rewriter.create<TestValidOp>(op->getLoc(), ArrayRef<Value>()); in matchAndRewrite()
434 rewriter.eraseOp(op); in matchAndRewrite()
445 PatternRewriter &rewriter) const final { in matchAndRewrite()
447 Type i32Type = rewriter.getIntegerType(32); in matchAndRewrite()
449 rewriter.createBlock(&region, region.end(), {i32Type, i32Type}, {loc, loc}); in matchAndRewrite()
450 rewriter.create<TerminatorOp>(loc); in matchAndRewrite()
451 rewriter.replaceOp(op, {}); in matchAndRewrite()
463 PatternRewriter &rewriter) const final { in matchAndRewrite()
465 Type i32Type = rewriter.getIntegerType(32); in matchAndRewrite()
467 rewriter.createBlock(&region, region.end(), {i32Type, i32Type}, {loc, loc}); in matchAndRewrite()
469 rewriter.create<ILLegalOpF>(loc, i32Type); in matchAndRewrite()
470 rewriter.create<TerminatorOp>(loc); in matchAndRewrite()
471 rewriter.replaceOp(op, {}); in matchAndRewrite()
484 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
486 rewriter.create<ILLegalOpF>(op->getLoc(), rewriter.getF32Type()); in matchAndRewrite()
487 rewriter.replaceUsesOfBlockArgument(op->getRegion(0).getArgument(0), in matchAndRewrite()
489 rewriter.updateRootInPlace(op, [] {}); in matchAndRewrite()
501 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
503 rewriter.setInsertionPointToStart(secondBlock); in matchAndRewrite()
504 rewriter.create<ILLegalOpF>(op->getLoc(), rewriter.getF32Type()); in matchAndRewrite()
505 rewriter.eraseBlock(secondBlock); in matchAndRewrite()
506 rewriter.updateRootInPlace(op, [] {}); in matchAndRewrite()
520 ConversionPatternRewriter &rewriter) const override { in matchAndRewrite()
529 failed(rewriter.convertRegionTypes(&region, converter, &result))) in matchAndRewrite()
533 rewriter.eraseOp(op); in matchAndRewrite()
543 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
544 rewriter.replaceOpWithNewOp<TestValidOp>(op, llvm::None, operands, in matchAndRewrite()
555 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
565 rewriter.replaceOpWithNewOp<TestReturnOp>(op, packerOp.getOperands()); in matchAndRewrite()
581 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
585 rewriter.replaceOpWithNewOp<TestTypeProducerOp>(op, rewriter.getF32Type()); in matchAndRewrite()
594 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
597 return rewriter.notifyMatchFailure(op, "expected single f32 operand"); in matchAndRewrite()
598 rewriter.replaceOpWithNewOp<TestTypeProducerOp>(op, rewriter.getF64Type()); in matchAndRewrite()
607 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
610 rewriter.replaceOpWithNewOp<TestTypeProducerOp>(op, rewriter.getBF16Type()); in matchAndRewrite()
619 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
623 rewriter.replaceOpWithNewOp<TestTypeConsumerOp>(op, operands[0]); in matchAndRewrite()
638 PatternRewriter &rewriter) const final { in matchAndRewrite()
640 auto illegalOp = rewriter.create<ILLegalOpF>(op->getLoc(), resultType); in matchAndRewrite()
641 auto legalOp = rewriter.create<LegalOpB>(op->getLoc(), resultType); in matchAndRewrite()
643 rewriter.replaceOp(illegalOp, {legalOp}); in matchAndRewrite()
644 rewriter.replaceOp(op, {illegalOp}); in matchAndRewrite()
663 PatternRewriter &rewriter) const final { in matchAndRewrite()
665 rewriter.updateRootInPlace(op, [&] { in matchAndRewrite()
666 op->setAttr("depth", rewriter.getI64IntegerAttr(op.getDepth() - 1)); in matchAndRewrite()
677 PatternRewriter &rewriter) const final { in matchAndRewrite()
679 rewriter.replaceOpWithNewOp<IllegalOpWithRegion>(op); in matchAndRewrite()
689 PatternRewriter &rewriter) const final { in matchAndRewrite()
693 rewriter.eraseOp(op); in matchAndRewrite()
694 rewriter.eraseOp(producer); in matchAndRewrite()
705 PatternRewriter &rewriter) const final { in matchAndRewrite()
706 IntegerAttr attr = rewriter.getI32IntegerAttr(0); in matchAndRewrite()
707 Value val = rewriter.create<arith::ConstantOp>(op->getLoc(), attr); in matchAndRewrite()
708 rewriter.replaceOpWithNewOp<LegalOpC>(op, val); in matchAndRewrite()
923 ConversionPatternRewriter &rewriter) const override { in matchAndRewrite()
931 remappedOperands.push_back(rewriter.getRemappedValue(origOp)); in matchAndRewrite()
932 remappedOperands.push_back(rewriter.getRemappedValue(origOp)); in matchAndRewrite()
934 rewriter.replaceOpWithNewOp<OneVResOneVOperandOp1>(op, op.getResultTypes(), in matchAndRewrite()
947 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
953 Block *finalBlock = rewriter.splitBlock(parentBlock, op->getIterator()); in matchAndRewrite()
954 rewriter.mergeBlocks(&block, parentBlock, ValueRange()); in matchAndRewrite()
955 rewriter.mergeBlocks(finalBlock, parentBlock, ValueRange()); in matchAndRewrite()
960 if (failed(rewriter.getRemappedValues(terminator->getOperands(), in matchAndRewrite()
964 rewriter.eraseOp(terminator); in matchAndRewrite()
965 rewriter.replaceOp(op, terminatorOperands); in matchAndRewrite()
1022 PatternRewriter &rewriter) const override { in matchAndRewrite()
1025 rewriter.eraseOp(op); in matchAndRewrite()
1067 PatternRewriter &rewriter) const override { in matchAndRewrite()
1075 auto *newOp = rewriter.create(state); in matchAndRewrite()
1076 rewriter.replaceOp(op, newOp->getResults()); in matchAndRewrite()
1118 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
1124 resultType = rewriter.getF64Type(); in matchAndRewrite()
1126 resultType = rewriter.getIntegerType(64); in matchAndRewrite()
1133 rewriter.replaceOpWithNewOp<TestTypeProducerOp>(op, resultType); in matchAndRewrite()
1146 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
1147 (void)rewriter.convertRegionTypes(&op->getRegion(0), *getTypeConverter()); in matchAndRewrite()
1163 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
1172 rewriter.updateRootInPlace( in matchAndRewrite()
1173 op, [&] { rewriter.applySignatureConversion(&region, result); }); in matchAndRewrite()
1188 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
1189 rewriter.updateRootInPlace(op, in matchAndRewrite()
1200 PatternRewriter &rewriter) const final { in matchAndRewrite()
1201 rewriter.replaceOpWithNewOp<TestTypeProducerOp>(op, op.getType()); in matchAndRewrite()
1337 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
1338 rewriter.replaceOp(op, adaptor.getOperands()); in matchAndRewrite()
1393 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
1399 rewriter.eraseOp(branchOp); in matchAndRewrite()
1400 rewriter.mergeBlocks(secondBlock, &firstBlock, replacements); in matchAndRewrite()
1401 rewriter.updateRootInPlace(op, [] {}); in matchAndRewrite()
1412 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
1416 rewriter.setInsertionPointToStart(secondBlock); in matchAndRewrite()
1417 rewriter.create<ILLegalOpF>(op->getLoc(), rewriter.getF32Type()); in matchAndRewrite()
1420 rewriter.eraseOp(branchOp); in matchAndRewrite()
1421 rewriter.mergeBlocks(secondBlock, &firstBlock, replacements); in matchAndRewrite()
1422 rewriter.updateRootInPlace(op, [] {}); in matchAndRewrite()
1436 ConversionPatternRewriter &rewriter) const final { in matchAndRewrite()
1444 rewriter.mergeBlockBefore(&innerBlock, op); in matchAndRewrite()
1445 rewriter.eraseOp(innerTerminator); in matchAndRewrite()
1446 rewriter.eraseOp(op); in matchAndRewrite()
1447 rewriter.updateRootInPlace(op, [] {}); in matchAndRewrite()
1509 PatternRewriter &rewriter) const final { in matchAndRewrite()
1515 rewriter.replaceOpWithIf(op, operands[0], [](OpOperand &operand) { in matchAndRewrite()
1520 rewriter.replaceOp(op, op.getOperand(1)); in matchAndRewrite()