[PATCH] D113756: [fir] Add fir.embox conversion
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 15 08:14:36 PST 2021
clementval added inline comments.
================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:1058-1059
+ // Order to find the Op in whose entry block the alloca should be inserted.
+ // The parent Op if it is an LLVM Function Op.
+ // The ancestor LLVM Function Op.
+ auto func = mlir::isa<mlir::LLVM::LLVMFuncOp>(op)
----------------
awarzynski wrote:
> clementval wrote:
> > awarzynski wrote:
> > > This isn't correct, is it?
> > Why?
> ```
> auto func = mlir::isa<mlir::LLVM::LLVMFuncOp>(op)
> ? mlir::cast<mlir::LLVM::LLVMFuncOp>(op)
> : op->getParentOfType<mlir::LLVM::LLVMFuncOp>();
> ```
> To me this means:
> * If this is a `LLVMFuncOp`, use it as the block for the newly inserted alloca.
> * Otherwise, use the block corresponding to the parent `LLVMFuncOp`
>
> The comment above this statement suggests otherwise. Or is it just me?
This is what the comment says.
`auto op = rewriter.getInsertionBlock()->getParentOp();` might be placed under the comment so it's easier to understand. If you have a better way to describe this feel free to propose it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113756/new/
https://reviews.llvm.org/D113756
More information about the llvm-commits
mailing list