https://github.com/E00N777 commented:

@Lancern  
Thanks! I tried `let llvmOp = "LifetimeStartOp"/"LifetimeEndOp"`, but it 
doesn't compile for these ops. cir-tblgen's `CIRLoweringEmitter.cpp` always 
emits `typeConverter->convertType(op.getType())`, and `op.getType()` only 
exists on single-result ops — `cir.lifetime.start/end` have no results:
```
error: 'class cir::LifetimeStartOp' has no member named 'getType'
```
This matches the rest of the dialect: every result-less op — 
`cir.stackrestore`, `cir.memcpy`, `cir.memset`,  … — uses a hand-written 
pattern. In particular `cir.stackrestore` has the exact same signature as these 
ops (one !cir.ptr operand, no result) and is lowered the same way I've done 
here:
```
rewriter.replaceOpWithNewOp<mlir::LLVM::StackRestoreOp>(op, adaptor.getPtr());
```
So I've kept the hand-written matchAndRewrite for now. Teaching 
CIRLoweringEmitter.cpp to support zero-result ops feels out of scope for this 
PR — I'd be happy to do it in a separate PR if you think it's worthwhile. WDYT?


https://github.com/llvm/llvm-project/pull/199599
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to