Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions flang/lib/Optimizer/CodeGen/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3575,6 +3575,14 @@ struct UndefOpConversion : public fir::FIROpConversion<fir::UndefOp> {
llvm::LogicalResult
matchAndRewrite(fir::UndefOp undef, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
if (mlir::isa<fir::DummyScopeType>(undef.getType())) {
// Dummy scoping is used for Fortran analyses like AA. Once it gets to
// pre-codegen rewrite it is erased and a fir.undef is created to
// feed to the fir declare operation. Thus, during codegen, we can
// simply erase is as it is no longer used.
rewriter.eraseOp(undef);
return mlir::success();
}
rewriter.replaceOpWithNewOp<mlir::LLVM::UndefOp>(
undef, convertType(undef.getType()));
return mlir::success();
Expand Down
Loading