Generating omp failed

Hi, I am trying a project based on mlir,I first use llvm at 79786c4d23f1fd7af438e4fd4e33ec109626bee4, and I create my dialect snn,there is a operation snn.test,and I override matchAndRewrite in SNNTestOpLowering,this operation worked normal before, but when I try to generate omp to parallel my code, there is something wrong, I can’t lowering my code,the operation ‘snn.test’ op still exist after lower-snn,this is my matchAndRewrite code

auto ompParallel = rewriter.create<omp::ParallelOp>(loc);
    {

      OpBuilder::InsertionGuard guard(rewriter);
      rewriter.createBlock(&ompParallel.getRegion());

      {
        OpBuilder::InsertionGuard allocaGuard(rewriter);
        Value old = rewriter.create<memref::LoadOp>(loc, outs, c0);
        Value new_val = rewriter.create<arith::AddIOp>(loc, in, old);
        rewriter.create<memref::StoreOp>(loc, new_val, outs, c0); 
        rewriter.create<omp::TerminatorOp>(loc);
      }
    }

how can I lowering my code or how can I use openmp in another way?
thanks for your help! :pray:

I found I don’t add OpenMPDialect into target.addLegalDialect,so the omp dialect doesn’t work. after adding it, it works normal :grinning: